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
 General SQL Server Forums
 New to SQL Server Programming
 Stored Procedure Won't Compile

Author  Topic 

gregoryagu
Yak Posting Veteran

80 Posts

Posted - 2010-12-15 : 23:19:38
(Sorry for the extreme newbie question here...)

I have this Stored Procedure which won't compile:
CREATE PROCEDURE MoveToSpecifiedFolder
@folderId int,
@ids varchar(4000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

Update EmailMessageEntities set FolderId = @folderId
where Id in (Select * from dbo.Split(@ids,',')
END


It says: Msg 156, Level 15, State 1, Procedure MoveToSpecifiedFolder, Line 20
Incorrect syntax near the keyword 'END'.

The function Split is defined and I can see it in MSSM under table defined functions. But it says "Invalid Object name", and the second parameter is in red.

Greg


gregoryagu
Yak Posting Veteran

80 Posts

Posted - 2010-12-15 : 23:27:19
Never mind, I was missing a closing parenthesis.

But, I still don't understand why MSSM says that dbo.Split is an invalid object name, yet it will run the functionn.
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2010-12-15 : 23:51:36
try to pass <databasename.dbo.functionname>.
Go to Top of Page

jessiefun
Starting Member

35 Posts

Posted - 2010-12-16 : 01:43:36
And the returned value from the function must have one column whose data type is the same with ID
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-12-16 : 10:10:31
quote:
Originally posted by ahmeds08

try to pass <databasename.dbo.functionname>.



Unnecessary. dbo.functionName is fine.
Go to Top of Page
   

- Advertisement -