In Katmai( A New Name of SQL 2008), A Couple of New Features Included, so here i am going to discuss How Inline Vairable initialization work in SQL 2008.
declare @i int = 1, @a = varchar(50) = 'Dipak',@b datetime = getdate();
--now to show this values
select @i,@a,@b
--to Increment the values of i
select @i+ = 1, @s += 'patel';
--to show this new value
select @i,@s;
These operation also work in DML Statements and Columns, for example Update statement in a table called 'testtable' with a column called 'testcolumn' where you want to increment the value of testcolumn by 1 could be;
update testTable set testColumn += 1;
and it is Also would work with other columns...if another column called testColumn2 existed:
update testTable set testColumn += testColumn2;
This will be New Features on SQL Server 2008.
Note: This Article is copied from Microsoft Web.
Thank you
Wednesday, August 1, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment