General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
It was probably created in whatever the default database was for your connection. Try the 'use' command to set this to the database you want this SP created in.
You should also prefix the name of the sp with dbo. so it will not be owned by your login, unless that is what you want:
lcSql='USE MyDateBase Create proc dbo.'+ALLTRIM(sqltable.csp_name)+" "
lcscript=ALLTRIM(sqltable.CSP_SCRIPT)
lcscript=STRTRAN(lcscript,'lcdatabase',gccurrentjob)
lcsql=lcsql+lcscript
lnSQLResult = SQLEXEC(gnConnectHandle,lcsql)
Also, did you check lnSQLResult to be sure it returned a zero?
BOb
>I have a VFP application that creates SQL Server databases and tables on the fly. I would also like to be able to create a stored procedure in the created database (this database is usually not the default database).
>
>I created a table in SQL that contains the stored procedure name and stored procedure code
>
>
>lcSql='Create proc '+ALLTRIM(sqltable.csp_name)+" "
>lcscript=ALLTRIM(sqltable.CSP_SCRIPT)
>lcscript=STRTRAN(lcscript,'lcdatabase',gccurrentjob)
>lcsql=lcsql+lcscript
>
>lnSQLResult = SQLEXEC(gnConnectHandle,lcsql)
>
>SQL acts like the command was successful but the stored procedure is not created.
>
>
>Any suggestions??
>
>Thanks.
>
>Joyce
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only