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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 loop and sqlcmd

Author  Topic 

Sieciowiec
Starting Member

4 Posts

Posted - 2011-12-10 : 11:18:03
Hi everyone
I have problem with script:
for %var1 IN (2011-01-01, 2011-01-02, itd., 2011-12-01) do
(sqlcmd -v xx="%var1% 06:20:00.000" yy="%var1% 14:19:59.997" -S SCADA -d Runtime -i "K:\zmianowe\Contumat_z1-test.sql"
-o "K:\zmianowe\Contumat_z1-test_%var1%_del.csv" -s ";"
-W type "K:\zmianowe\Contumat_z1-test_%var1%_del.csv" | findstr /v \-\- > "K:\zmianowe\Contumat_z1-test_%var1%.csv"
del "K:\zmianowe\Contumat_z1-test_%var1%_del.csv")
But it's don't work

I need results like:
Contumat_z1-test_2011-01-01.csv
Contumat_z1-test_2011-01-02.csv
etc.
   

- Advertisement -