JCM0165
asked on
SqlException 'Function name' is not a recognized built-in function name.
MS SQL 2005
This is a function within a stored procefure
SET @FunctionText = N'SELECT @Achieved = ' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
EXEC sp_executesql @FunctionText, N'@Achieved int output ',@Achieved out
generates error
SqlException (0x80131904): 'F_SELECT_FITPOINT_ADHEREN CE' is not a recognized built-in function name.
when I make it a 2-partname, I get the error
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Function_Name", or the name is ambiguous.
This is a function within a stored procefure
SET @FunctionText = N'SELECT @Achieved = ' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
EXEC sp_executesql @FunctionText, N'@Achieved int output ',@Achieved out
generates error
SqlException (0x80131904): 'F_SELECT_FITPOINT_ADHEREN
when I make it a 2-partname, I get the error
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Function_Name", or the name is ambiguous.
ASKER
anee,
when I make it a 2-partname, I get the error
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Function_Name", or the name is ambiguous.
when I make it a 2-partname, I get the error
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.Function_Name", or the name is ambiguous.
>I make it a 2-partname, I get the error
How did you do that ? did you modify the Query ,if so paste it here ?
aneesh
How did you do that ? did you modify the Query ,if so paste it here ?
aneesh
ASKER
Annesh, here
SET @Function =
(
SELECT TOP (1) Function_
FROM FitPoint_Categories
WHERE (Order_ = @Order) AND (Deleted <> 1) AND FPQ_ID = @FPQ_ID
ORDER BY FPC_ID DESC
)
SET @FunctionText = N'SELECT @Achieved = ' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
EXEC sp_executesql @FunctionText, N'@Achieved int output ',@Achieved out
SET @Function =
(
SELECT TOP (1) Function_
FROM FitPoint_Categories
WHERE (Order_ = @Order) AND (Deleted <> 1) AND FPQ_ID = @FPQ_ID
ORDER BY FPC_ID DESC
)
SET @FunctionText = N'SELECT @Achieved = ' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
EXEC sp_executesql @FunctionText, N'@Achieved int output ',@Achieved out
I haven't seen where you added that 'dbo', Okay, i am going to add that owner of that function
SELECT TOP 1 @Function = Function_
FROM FitPoint_Categories
WHERE (Order_ = @Order) AND (Deleted <> 1) AND FPQ_ID = @FPQ_ID
ORDER BY FPC_ID DESC
SELECT @Function = ROUTINE_SCHEMA+'.' +@Function
FROM information_Schema.Routine
WHERE ROUTINE_NAME = @FunctionName
SET @FunctionText = N'SELECT @Achieved = dbo.' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
EXEC sp_executesql @FunctionText, N'@Achieved int output ',@Achieved out
ASKER
got
Must declare the scalar variable "@FunctionName".
ASKER
used @Function instead of @FunctionName
got
Cannot find either column "fasterfitness" or the user-defined function or aggregate "fasterfitness.F_SELECT_FI TPOINT_ADH ERENCE", or the name is ambiguous.
got
Cannot find either column "fasterfitness" or the user-defined function or aggregate "fasterfitness.F_SELECT_FI
ooops, change '@FunctionName' to '@Function'
SELECT TOP 1 @Function = Function_
FROM FitPoint_Categories
WHERE (Order_ = @Order) AND (Deleted <> 1) AND FPQ_ID = @FPQ_ID
ORDER BY FPC_ID DESC
SELECT @Function = ROUTINE_SCHEMA+'.' +@Function
FROM information_Schema.Routine s
WHERE ROUTINE_NAME = @FunctionName
SET @FunctionText = N'SELECT @Achieved = dbo.' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
print @functionName
FROM FitPoint_Categories
WHERE (Order_ = @Order) AND (Deleted <> 1) AND FPQ_ID = @FPQ_ID
ORDER BY FPC_ID DESC
SELECT @Function = ROUTINE_SCHEMA+'.' +@Function
FROM information_Schema.Routine
WHERE ROUTINE_NAME = @FunctionName
SET @FunctionText = N'SELECT @Achieved = dbo.' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as varchar(12)) + N'")' ------
print @functionName
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dbo.F_SELECT_FITPOINT_ADHE