March 24, 2006 at 10:43 am
This is what I have used...
OSQL -U dhuserid -P dhpass -S server2000 -d dh_db -i E:\nessus.sql -o E:\daveout.log -n
He states that the nessus.sql file may be this... or nssus1, 2, 3, 4... etc have no way of knowing ahead of time... I tried *.sql and nss*.sql but it won't accept it.
Any help is appreciated.
March 24, 2006 at 10:56 am
you could pull all the file names into a temp table by calling the dos command dir through xp_cmdshell, after you have the file name in the table set up a loop to build the osql string and again run that trough xp_cmdshell.
Here is a link that may point you in the right direction:
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=150
March 24, 2006 at 12:46 pm
I do understand that you are trying to run OSQL from a dos script.
I would query the directory, dynamically compose OSQL line and then run. I would do it from VBscript using filesystemobject. For example, I am getting all CSV files for my application into a list of files as save this list as a file. It is very easy in VB to append strings before and after the file name. Then we will have a file of the OSQL statements for each sql file in the directory. Then we save this file as mylist.bat some time before the scheduled job executing this file runs.
Regards,Yelena Varsha
March 24, 2006 at 1:42 pm
Try the old DOS For command
for %f in (n*.sql) do OSQL -U dhuserid -P dhpass -S server2000 -d dh_db -i %f -o %f.log -n
March 24, 2006 at 3:24 pm
I tested it, it works! Good Job David!
They say in Russia that " NEW is a well forgotten OLD "
Regards,Yelena Varsha
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply