Top "Tsql" questions

T-SQL (Transact Structured Query Language) is the extension of SQL functionality supported by Sybase ASE and Microsoft SQL Server.

Pad a string with leading zeros so it's 3 characters long in SQL Server 2008

I have a string that is up to 3 characters long when it's first created in SQL Server 2008 R2. I would …

sql-server tsql
How can I select the first day of a month in SQL?

I just need to select the first day of the month of a given datetime variable. I know it's quite …

sql sql-server tsql sql-server-2008 datetime
SQL exclude a column using SELECT * [except columnA] FROM tableA?

We all know that to select all columns from a table, we can use SELECT * FROM tableA Is there a …

sql sql-server tsql
How to set variable from a SQL query?

I'm trying to set a variable from a SQL query: declare @ModelID uniqueidentifer Select @ModelID = select modelid from models where …

sql sql-server tsql
SQL: IF clause within WHERE clause

Is it possible to use an IF clause within a WHERE clause in MS SQL? Example: WHERE IF IsNumeric(@OrderNumber) = 1 …

sql sql-server tsql
How do I split a string so I can access item x?

Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John …

sql sql-server tsql split
How to get Time from DateTime format in SQL?

I want to get only Time from DateTime column using SQL query using SQL Server 2005 and 2008 Default output: AttDate == 2011-02…

sql-server tsql sql-server-2005 datetime
SQL Server SELECT INTO @variable?

I have the following code in one of my Sql (2008) Stored Procs which executes perfectly fine: CREATE PROCEDURE [dbo].[Item_…

sql sql-server tsql sql-server-2008
Best approach to remove time part of datetime in SQL Server

Which method provides the best performance when removing the time portion from a datetime field in SQL Server? a) select …

sql sql-server tsql datetime date
Insert multiple rows WITHOUT repeating the "INSERT INTO ..." part of the statement?

I know I've done this before years ago, but I can't remember the syntax, and I can't find it anywhere …

sql-server tsql sql-server-2005 insert