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 2000 Forums
 SQL Server Administration (2000)
 Pass parameter in ISQL command

Author  Topic 

nivaskhan
Starting Member

17 Posts

Posted - 2003-01-21 : 01:10:22
Hello

Is there any way of passing in the arguments (e.g. -S , -U, -P) from the isql utility into a script? Basically I need to pass in the Server name , username and password into a script from the isql command.
The script file has some bcp commands which is used to load the data from the text files into the required tables.I cant use bulk insert and have to go with bcp inside the script file.



Regards,
Nivas

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-01-21 : 13:34:24
I am not sure if I am understanding you correctly. You can setup variables in a batch file. Then wherever it says -S, -U, -P, you can pass the variable instead. But you wouldn't be passing in the variables say from an input box, they would be declared at the top of the batch file. If you need input boxes, consider using VBScript to call the isql utility.

Example of variables in a batch file:
SET OSQLAUTH=-Usa -Psapwd
SET SERVER = SERVER1

isql -S%SERVER% %OSQLAUTH% -iC:\temp\somefile.sql -n

Go to Top of Page
   

- Advertisement -