Good to Know in SQL server 2008
1. Insert values:
Many times we use “INSERT INTO tab_name VALUES (….) “way for inserting the data into table. There is a simple way in the SQL server 2008 to avoid multiple INSERT clauses for more than one record. It is possible in single statement.
use tempdb
Create table Dept(Id int, DName varchar(100))
Insert into Dept
values
(1,'A'),
(2,'B'),
(3,'C'),
(4,'D')
select * from Dept
2.Declare and initiate in same lines:
Old style ( SQL 2000 and 2005) :
declare @i int
set @i = 10
declare @dt datetime
set @dt = GETDATE()
select @i as Col1, @dt as Col2
New Style (SQL server2008):
declare @i int = 10
declare @dt datetime = getdate()
select @i as Col1, @dt col2
go
Tuesday, June 22, 2010
Good to Know in SQL server 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment