|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Text file importI have multiple text files need to be imported into SQL server. All files use
same column delimiter, row delimiter but have different number of columns. Some have over 100, some have just 10 or 20. I am wondering if there is a way to import them together, not one by one. Thanks for the help! I did find DTS example about importing multiple txt files into SQL server.
All files have same data format, same number of columns and it import all the files into one table. I need to import those files to different tables. For example, I have files a.txt, b.txt, c.txt, I need to import them into table a, table b, table c. Sometime, I might have over 100 files. It really time consuming to do import one by one. Thanks for help! Show quote "Grace" wrote: > I have multiple text files need to be imported into SQL server. All files use > same column delimiter, row delimiter but have different number of columns. > Some have over 100, some have just 10 or 20. I am wondering if there is a way > to import them together, not one by one. Thanks for the help! Whichever way you look at this, one thing is blindingly obvious - you'll need
as many tasks as there are file schemas. I'd suggest using sp_addlinkedserver to link directly to the files, while their structure is declared in an appropriate schema.ini file. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_adda_8gqa.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp ML --- http://milambda.blogspot.com/ thanks very much for the reply. I'll give a try.
Show quote "ML" wrote: > Whichever way you look at this, one thing is blindingly obvious - you'll need > as many tasks as there are file schemas. > > I'd suggest using sp_addlinkedserver to link directly to the files, while > their structure is declared in an appropriate schema.ini file. > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_adda_8gqa.asp > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp > > > ML > > --- > http://milambda.blogspot.com/ |
|||||||||||||||||||||||