| Author |
Topic  |
|
|
AskSQLTeam
Ask SQLTeam Question
USA
0 Posts |
|
|
putsik
Starting Member
2 Posts |
Posted - 06/18/2004 : 03:41:14
|
Good Article.
What if my text file is located on another computer, do you have any idea on how to do this?
thank You |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
USA
4184 Posts |
|
|
nr
SQLTeam MVY
United Kingdom
12543 Posts |
Posted - 06/18/2004 : 09:27:20
|
I would copy the files to a local drive first. It will make the import a lot faster and have less impact on the database. Not important for small files but can make a big difference for large ones.
========================================== Cursors are useful if you don't know sql. DTS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|
thaoton
Starting Member
1 Posts |
Posted - 09/13/2006 : 17:27:15
|
Any chance someone could help me modify Nigel's script to work with Tab-Quote delimited files? There's a header in every file.
Example Data:
"Name" "Value" "Brian McMillen" "1722" "Anthony Adams" "8532" "Erik Jenner" "7209" "Terrance Walker" "1873" "Matthew Sullivan" "7337" |
 |
|
|
nr
SQLTeam MVY
United Kingdom
12543 Posts |
Posted - 09/14/2006 : 05:03:11
|
Depends how much data there is. This process won't be good for large amounts - maybe 1G would be ok depending on the machine.
Create the function f_GetEntryDelimiitted http://www.nigelrivett.net/SQLTsql/f_GetEntryDelimiitted.html
Now the merge sp becomes insert BCPData ( fld1 , fld2 , fld3 , fld4 ) select fld1 = dbo.f_GetEntryDelimiitted(s,1,',','Y') , fld2 = dbo.f_GetEntryDelimiitted(s,2,',','Y') , fld3 = dbo.f_GetEntryDelimiitted(s,3,',','Y') , fld4 = dbo.f_GetEntryDelimiitted(s,4,',','Y') from ##Import
Note ##Import should be #Import.
There are more efficient ways to do this but this is very simple. I use it for small imports.
========================================== Cursors are useful if you don't know sql. DTS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
| |
Topic  |
|