We have to create a stored procedure which runs in SQL 2000. The swtored procedure has to take a database name as input paramaeter and then it has to create a scalar valued function in the input database. Following is the query i'm using but it's creatin
in on the current database only not on the input database.
ALTER PROCEDURE SP_ABC
SET NOCOUNT ON
DECLARE @SQL1 NVARCHAR(50)
DECLARE @SQL2 NVARCHAR(800)
SET @SQL1='USE '+@DBNAME+' ;'
SET @SQL2='CREATE function dbo.fn_C (@string1 varchar(15))
Even I tried to merge use db statement before create function, but it's throwing an error saying 'create function has to be the first parameter'
Please suggest how can I acheive the functionality by modifying the stored procedure.
Thanks in dvance.
View Complete Post