Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call ISQL shell to create stored procedure in VB

Status
Not open for further replies.

MDA

Technical User
Jan 16, 2001
243
US
Hi all,
( I posted this also in the SQL server section, it kinda falls under both areas, excuse the duplication)

I am trying to create a stored procedure during the install of a small VB app I have created. The Stored procedure uses T-SQL so I cannot create it through ADO, etc.

I was thinking that if I put the stored procedure in a TEXT file then execute by calling ISQL during the VB install. One hitch I know of is that the user will not be on the server, nor have Query analyzer on their machine.

Is this possible??? How does one typically create stored procedures like this. Note: the DB is already created, I just want to add a stored procedure.

Any help on how to call ISQL.exe and insert the contents of a text file (containing the SP) is greatly appreciated.

Thanks in advance for any help on this.

Mike
 
Try the command line version of isql:

isql -S servername -U username -P password -d database -i scriptfilename

(n.b. the flag letters are case sensitive - you can get a complete list using isql /?)

Obviously the user you specify needs to have the correct privileges to run the script.

To call a command-line program from VB use the SHELL command.

Of course, all this presumes the target machine has access to isql in the first place ...

Rob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top