Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2007-06-19 : 04:09:11
|
| i am using this code to upload file to a TempTable in the SQL SERVER :"for %%f in ( F:\Temp\*.txt) do bcp ....."the thing is that this code load all the file that in a given folder to the table.is it possible to some how (using a switch or anything else) that only 10 files each time will be uploaded?thnaks in advancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-06-19 : 07:59:30
|
| for %%f in ( F:\Temp\*.txt) do CALL :MyAction ....."and have MyAction increment an Environemtn Variable, and bail out once it gets to 10 ?Move all-BUT 10 files OUT of F:\Temp before you start?Kristen |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2007-06-19 : 08:13:02
|
| the most simple solution of course is to move every time 10 files to another folder and load from therei thought maybe i can do it as part as the for commandhow do i implement your code to the end so it will work?Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-19 : 08:18:35
|
why not use BULK INSERT ? you can control the files to import from T-SQL. KH |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-06-19 : 08:24:58
|
Something like this perhaps?SET MyCount=0for %%f in ( F:\Temp\*.txt) do CALL :MyAction %%f"GOTO NextStep:MyActionMOVE %1 F:\TEMP\WorkFilesGOTO END:NextStep... Process files in F:\TEMP\WorkFiles ...GOTO END:END Kristen |
 |
|
|
|
|
|