|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Import Comma delimited textI need to create a stored procedure to import a comma delimited text file
into a SQL table. I am new to SQL, am very compfortable with VB and Access. Anyone have a good reference for me to look at? A good source of info for me to start with? Pointers? Anything? Thanks! Refer "BULK INSERT, BULK INSERT (described)" in BOL
-- Show quoteThanks Ravi "Rick" wrote: > I need to create a stored procedure to import a comma delimited text file > into a SQL table. I am new to SQL, am very compfortable with VB and Access. > Anyone have a good reference for me to look at? A good source of info for me > to start with? > > Pointers? Anything? > > Thanks! > > Take a look at bulk insert at books online. Below is an example of using
bulk insert into a table. Create table #temp_supress_emails ( emailaddress nvarchar(50) ) /* file looks like this -- you must have permissions to access the file from sql to the desired path. whate***@whatever.com, Whatev***@whatever2.com, Whatev***@whatever3.com, Whatever4sdfjksdfkj.com */ BULK INSERT [dbo].[#temp_supress_emails] FROM '\\bldal-jpruiett\c$\emails.txt' WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = ' ', FIRSTROW = 1, ROWTERMINATOR = ',\n' ) Select * from #temp_supress_emails There are several good resouses on the web just go to www.google.com/microsoft which will filter all the results to just microsoft results which makes it easier to find what you are looking for like error messages, syntax, examples etc. Show quote "Rick" wrote: > I need to create a stored procedure to import a comma delimited text file > into a SQL table. I am new to SQL, am very compfortable with VB and Access. > Anyone have a good reference for me to look at? A good source of info for me > to start with? > > Pointers? Anything? > > Thanks! > > |
|||||||||||||||||||||||