In SQL Server 2005 the Bulk Insert is the special Sql statement to insert the bulk data of CSV or another type of files
with field separator character(i.e,; or ^ or , or . separator).
Syntax for Bulk insert:
USE Test
GO
CREATE TABLE USER
(
ID INT ,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME
)
GO
BULK
INSERT USER
FROM 'F:\User.txt'WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
Example Script Available for Bulk Insert and Shell Command for getting Files List as Table and upload the files to Database(i.e .dcnlog type files).Click Here to Download...



0 comments:
Post a Comment