a very cool feature of SQL Server to import a CSV file into a table through a T-SQL.. here it is:
------------------------************************-----------------------------
Create Table CSVTest
(
id int, name varchar(20), location varchar(20)
)
bulk
insert CSVTest
from 'd:\testfile.txt'
with
(
FieldTerminator = ',',
RowTerminator = '\n'
)
go
select * from csvtest
------------------------------***********************-------------------
Thursday, June 11, 2009
Subscribe to:
Post Comments (Atom)
First of all thanks for the easy code you have provided. Can you please tell me if we have file on network path, then which user should be given rights of that shared folder ?? is that the user with which we login sql? or any other user,
ReplyDeleteThanks in advance.
Zeeshan Hameed
CEO
www.Sharewithgurus.com
www.sale-classifieds.com
www.Sharewithgurus.com/WP/
www.names-meaning.net