USE [Demo]
GO
GO
--Create Demo Table—
CREATE TABLE DemoTable(Data VARCHAR(50))
--The way we used to—
INSERT INTO DemoTable(Data)
VALUES ('DATA 1');
INSERT INTO DemoTable(Data)
VALUES ('DATA 2');
INSERT INTO DemoTable(Data)
VALUES ('DATA 3');
INSERT INTO DemoTable(Data)
VALUES ('DATA 4');
Solution 1:
CREATE TABLE DemoTable(Data VARCHAR(50))
INSERT INTO DemoTable(data)
VALUES ('DATA 1'),('DATA 2'),('DATA 3'),('DATA 4');
Solution 2:
CREATE TABLE DemoTable(Data VARCHAR(50))
INSERT INTO DemoTable(data)
SELECT 'DATA 1'
UNION ALL
SELECT 'DATA 2'
UNION ALL
SELECT 'DATA 3'
UNION ALL
SELECT 'DATA 4'
No comments:
Post a Comment