Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

Recent questions tagged TSQL

0 votes
517 views
1 answer
    I know the syntax: ALTER TABLE [TheTable] DROP CONSTRAINT [TheDefaultConstraint] but how to I drop the default ... at CREATE TABLE time.) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
475 views
1 answer
    How can I convert a String to a Date in T-SQL? My test case is the string: '24.04.2012' See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
617 views
1 answer
    I'm looking for a built-in function/extended function in T-SQL for string manipulation similar to the String.Format method in .NET. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
758 views
1 answer
    I need to ALTER the data types of several columns in a table. For a single column, the following works fine ... 0), CM_CommodityID NUMERIC(18,0) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
528 views
1 answer
    In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField ... I tried it!) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
696 views
1 answer
    How do I add a string with auto-increment value in SQL Server? create table date (sno int 'emp_'+ ... need following as output emp_1 emp_2 See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
676 views
1 answer
    I am working on an SQL Query using pvots with dynamic columns in SQL Server (T-sql). Rather than submitting ... hard coded? Thanks Leon Lai See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
550 views
1 answer
    I use DATEDIFF function to filter records added this week only: DATEDIFF(week, DateCreated, GETDATE()) = 0 and I ... 0 in third column too. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
686 views
1 answer
    I am working with SQL Server 2008 R2, trying to calculate a moving average. For each record in my view, I ... data within a range of records. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
624 views
1 answer
    I am maintaining some code that has a trigger on a table to increment a column. That column is then ... trigger to avoid cursor based approach See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
659 views
1 answer
    I have a table where I created an INSTEAD OF trigger to enforce some business rules. The issue is that when I ... How do I make this work? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
465 views
1 answer
    The following: MERGE dbo.commissions_history AS target USING (SELECT @amount, @requestID) AS source (amount, request ... with this mechanism. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
908 views
1 answer
    What is the best way to shorten a datetime that includes milliseconds to only have the second? For example 2012-01-25 ... 2012-01-25 17:24:05 See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
632 views
1 answer
    According to BOL (SQL Server Books Online) on sp_dbcmptlevel, This feature will be removed in a future version ... level without using GUI? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
820 views
1 answer
    Now when I query SELECT @@language it gets 'us_english'. But I need russian. I can't use SET LANGUAGE russian ... (for all new sessions). See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
762 views
1 answer
    How can rows with non-ASCII characters be returned using SQL Server? If you can show how to do it for one ... SPACE (3210) through ~ (12710) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
538 views
1 answer
    I have a problem using RANK() in SQL Server. Here's my code: SELECT contendernum, totals, RANK() OVER ( ... numbers will have the same xRank. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
798 views
1 answer
    I have to calculate the difference in hours (decimal type) between two dates in SQL Server 2008. I couldn't find ... it should return me 1.5. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
557 views
1 answer
    When adding an item in my database, I need it to auto-determine the value for the field DisplayOrder. Identity ... there a better/simpler way? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
526 views
1 answer
    If we have a table like this: Grp Value Grp1 2 Grp1 5 Grp1 3 Grp2 3 Grp2 -5 Grp2 -2 Grp3 4 Grp3 0 Grp3 1 ... 0 Grp4 8 Grp5 7 Grp6 NULL Grp7 -10 See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
589 views
1 answer
    I tried this SELECT convert(datetime, '23/07/2009', 111) but got this error The conversion of a varchar data type ... How to fix the 1st one ? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
587 views
1 answer
    Is it true that SQL Server 2000, you can not insert into a table variable using exec? I tried this script and ... that true, what should I do? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
575 views
1 answer
    I have a SQL Server database. One field has values which are like ID VALUE 1 NEGATIF 2 11.4 3 0.2 4 A RH(+) ... add more filter like [-+ ()] ? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
496 views
1 answer
    Is there a way to search for one value (in my case it is a UID of the type char(64)) inside any column ... pain if the database is too huge. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
649 views
1 answer
    I have a string like this: 72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San Francisco,CA:72594221871 ... its output into a table somehow? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
499 views
1 answer
    I am writing a function that returns a table. There are two parameters that are passed to the function and ... SP_EXECUTESQL @SQL RETURN END GO See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
614 views
1 answer
    I am wondering why I cannot use variable column name like that: declare @a as varchar; set @a='TEST' select @a from x; Thank you See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
481 views
1 answer
    Is it a good idea to index varchar columns only used in LIKE opertations? From what I can read from query ... has been optimized with an index? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...