Microsoft has extended the support of inline variable initialization feature from the programming languages in to T-SQL in SQL Server 2008.
When we want to declare and initialize a value to variable in T- SQL, we need to do it is two steps (declaration & initialization) as shown in the example
DECLARE @V_Value DATETIME
SET @V_Value =GETDATE()
In SQL Server 2008 this can be simplified by combining both the lines into a single steps as we do in programming languages
DECLARE @V_Value DATETIME = GETDATE()
Even though it is a very small feature, it helps the developers who have the technical background for programmig languages like JAVA, C#.NET , VB.NET etc
Friday, 30 January 2009
Sunday, 25 January 2009
I was working with SQL Server 2008 for quite some time and noticed a strange behavior (which is not in previous versions of SQL Server) when I try to save a table in Management Studio that requires table to be dropped and recreated (e.g. Try to ADD a new NOT NULL column to the table which is having data) .I get the following warning message
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
I though it is bug with SQL Server, but later cam to know it is the expected behavior and can be turned of by unchecking "Prevent saving changes that require table re-creation" in the Designer properties. Please refer to the below screen shot