Displaying posts filed under

TSQL Development

Apr
1
2009

Deprecated Features in SQL server 2008

Here are the List of features that are deprecated in Sql server 2008 http://msdn.microsoft.com/en-us/library/ms143729.aspx

Mar
31
2009

Organising your Favourite SQL statments

I constantly keep querying the Database sometimes for checking the metadata in the DatawareHouse. Lately I realised that have been executing the same long sql statements everyday. So is there a better way of Organising all my Favourite SQL statments or procedures ? This is what I ended up with. Create a Table The table [...]

Mar
29
2009

DayLight Savings and Sql Agent

Ran a Job yesterday to check how the SQL agent Handles the DayLight Savings Created the following Table Created the Following procedure to enter the current Date and Ran the Job every minute from March 28th 2009 22:50 to Mar 29th 2009 3:00 AM Results: There was no 01:00 AM on March 29th !!!!. So [...]

Mar
11
2009

When the Procedures were Last Modified

SELECT name, create_date, datepart(dy,create_date) as CreatedDayOfYear, modify_date, datepart(dy,modify_date) as ModificationDayOfYear FROM sys.sql_modules JOIN sys.objects ON sys.sql_modules.object_id = sys.objects.object_id AND TYPE = ‘P’ order by datepart(yyyy,modify_date) desc, datepart(dy,modify_date) desc, name;

Mar
11
2009

Proper Case in Sql Server

Here is the Sql function that will Proper Case any column in a table set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO create function [dbo].[ProperCase](@Text as varchar(8000)) returns varchar(8000) as begin declare @Reset bit; declare @Ret varchar(8000); declare @i int; declare @c char(1); select @Reset = 1, @i=1, @Ret = ” while (@i <= len(@Text)) select [...]

Feb
24
2009

“Set identity_insert on” errors for more than one table

I was trying to remove the Identity inserts for 4 tables all at once but I keeping getting errors like Cannot remove the Identity insert on table 2 as the table1 already has identity insert on. So after digging into the MSDN I was surprised to see the following lines “At any time, only one [...]

Feb
16
2009

Assignment Operators in TSQL 2008

TSQL has improved its assignment Operators in the C language convention. In SQL SERVER 2000 or SQL SERVER 2005 the assignment operators are written as Declare @i int Declare @s varchar(100) set @i = 10 set @s = ‘WORD’ set @i = @i  * 40 set @s = @s + ‘PRESS’ In SQL SERVER 2008 [...]

Feb
16
2009

Single Statement Variable Declaration

A new feature in Sql server 2008 TSQL is the Single Statement Variable Declaration. What is this? In Sql Server 2000 or Sql Server 2005 the declare statements are written as follows Declare @i int,@j int ,@k int set @i = 100 set @j = 200 set @k = 300 The Above Statement in Sql [...]