troubleshooting Question

'CREATE FUNCTION must be the only statement in the batch' SQL Server 2008

Avatar of doramail05
doramail05Flag for Malaysia asked on
Microsoft SQL Server 2005Microsoft SQL Server 2008
11 Comments1 Solution8441 ViewsLast Modified:
while creating function in sql server 2008

getting :
'CREATE FUNCTION must be the only statement in the batch'

after checking, have only one CREATE Function in the whole statement
CREATE FUNCTION fnModuleResultRanking

( 

-- Add the parameters for the function here

@ModuleID BIGINT

)

RETURNS TABLE 

AS

RETURN 

(

SELECT     ROW_NUMBER() OVER (ORDER BY totalmoduleresult DESC) AS number, *
FROM         ModuleResult mr
WHERE     mid = @ModuleID AND intakeid IN (1, 2, 3);
)

GO
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros