Tuesday, November 29, 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
)

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

selectfrom @InputTable;

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

No comments:

Post a Comment

IIS Manager Crashes on Load/Start Windows 7, IIS 7.5

IIS Manager Crashes on Start  Windows 7, IIS 7.5, Power Shell 5.1. Here is the error I got in the event viewer. IISMANAGER_CRASH IIS Ma...