What's new in SQL Server 2008: You can insert multiple rows using a single insert command.
Create TableDemo_values (PKIDInt Not Null Identity(1,1)Primary Key, dnameNvarchar(20)Null, DCodeNVarchar(30)Null, DdateDatetime Null)Go
--This SQL was only for SQL Server 2008 Insert IntoDemo_values (Dname,dcode,ddate)Values(‘Demoa‘,‘Aaa‘,GETDATE()), (‘Demob‘,‘Bbb‘,GETDATE()), (‘Democ‘,‘Ccc‘,getdate ()), ( demod ' , ddd ' ,getdate ()), ( ' demoe ", ' eee ,getdate ())
--< Span style= "color: #008080;" > (5 row (s) affected)
In addition to inserting more than one line at a time, values has a more subtle use of using a permanent table or temporary table instead of a result set, and does not require a function or table variable. Look at the following example:
--This SQL was only for SQL Server 2008 SelectDname,dcode,ddateFrom(Values(‘Demoa‘,‘Aaa‘,GETDATE()), (‘Demob‘,‘Bbb‘,GETDATE()), (‘Democ‘,‘Ccc‘,GETDATE()), (‘Demod‘,‘Ddd‘,getdate ()), ( demoe ' , eee ' ,getdate ())) demo_values (dname,dcode,ddate) -- (5 row (s) affected) /* dname DCode ddate Demoa AAA 2010-10-12 20:37:45.500 demob BBB 2010-10-12 20:37:45.500 Democ CCC 2010-10-12 20:37:45.500 Demod DDD 2010-10-12 20:37:45.500 demoe EEE 2010-10-12 20:37:45.500 */
Note the last line of the statement defines the source name and the column name, where the column name is used for the SELECT statement.
One of the SQL enhancements in SQL Server 2008: Values new use