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

Comments

Popular posts from this blog

Duplicate Folders Freeware - Not Duplicate Files

SSRS Compile Errors

Free SQL Server Management Studio Addin/Plugin/External Tool to get object information quickly