Tuesday, May 3, 2011

Insert multiple rows into table in mssql using insert - select - union

INSERT INTO @boy
(
id,
name,
is_stud
)(
SELECT 1, 'Ben', 0 UNION ALL
SELECT 2, 'Arnold', 0 UNION ALL
SELECT 3, 'Vincent', 0
);


Above query quoted from
http://www.bennadel.com

No comments: