Posts

Showing posts from November, 2011

New Values Clause Sql Server

Values clause in sql server is a new way to insert mulitple rows into the table one time.This is how to do it.


DECLARE @InputTable table (
  Name varchar(max),
 ID uniqueidentifier
)

INSERTINTO @InputTable
VALUES
('a','487671D5-1F05-4F2D-9A3B-5DC7EA3E046E'),
('b','487671D5-1F05-4F2D-9A3B-5DC7EA3E046E'),
('c','487671D5-1F05-4F2D-9A3B-5DC7EA3E046E')

select* from @InputTable;

------------------
Name ID
a 487671D5-1F05-4F2D-9A3B-5DC7EA3E046E
b 487671D5-1F05-4F2D-9A3B-5DC7EA3E046E
c 487671D5-1F05-4F2D-9A3B-5DC7EA3E046E