CREATE TABLE #Test
(
firstCol varchar(50) NOT NULL,
secondCol varchar(50) NOT NULL
)
Go
BULK INSERT #Test FROM ‘d:\Book1.csv’ WITH (FIELDTERMINATOR = ‘,’, ROWTERMINATOR = ‘\n’)
GO
INSERT INTO myTbl
(
name,
code
)
SELECT firstCol,
secondCol
FROM #Test
GO
DROP TABLE #Test
(
firstCol varchar(50) NOT NULL,
secondCol varchar(50) NOT NULL
)
Go
BULK INSERT #Test FROM ‘d:\Book1.csv’ WITH (FIELDTERMINATOR = ‘,’, ROWTERMINATOR = ‘\n’)
GO
INSERT INTO myTbl
(
name,
code
)
SELECT firstCol,
secondCol
FROM #Test
GO
DROP TABLE #Test
Comments
Post a Comment