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 Development (2000)
 Stored Proc not getting executed in VBScript

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-03 : 08:21:09
Tariq writes "Hi,
This is the problem I am facing.
I am calling a stored procedure which accepts a string.
The stored proc parses the string which is comma separated numbers. (Example: '3,4,5,6,7') The stored procedure then casts them into numeric and then deletes the data found in the table for these numeric ids. This works fine when I execute it from Query Analyser. But when I execute it in my vbscript (used to data migration) it goes to the 'exec' statement and exits the script without logging an error.

I am pasting the code below:
cmd.ActiveConnection = cn
cmd.CommandText = "[AETH\N181362].spDeleteVTIDs"
cmd.CommandType = 4 'for adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, adParamInput)
cmd("Param1") = sWhClause 'This contains the comma separated string '3,4,5,6'
WRITELOG "Deleting Now"
cmd.Execute

Please reply soon, this is extremely urgent.
Thanks,
T."

nr
SQLTeam MVY

12543 Posts

Posted - 2005-02-03 : 09:03:11
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, adParamInput)
cmd("Param1") = sWhClause 'This contains the comma separated string '3,4,5,6'

If you are passing a csv string then the parameter type cannot be int - it has to be a string.
Also is AETH\N181362 the owner of the sp?



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -