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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 print result from stored procedure

Author  Topic 

-Dman100-
Posting Yak Master

210 Posts

Posted - 2009-03-11 : 17:59:37
I'm trying to debug a stored procedure in Query Analyzer and determine why I keep getting an incorrect result back.

How do I print the result to the screen and execute the stored procedure.

This is what I was trying:

DECLARE @result int
SET @result = EXEC spUpdateFile 51,'SAAG.PDF','\CompassFileUpload\','Solutions-At-A-Glance','','51SAAG.PDF', 0
PRINT @result

Incorrect syntax near the keyword EXEC

Thanks for any help.

guptam
Posting Yak Master

161 Posts

Posted - 2009-03-11 : 19:43:30
try ...

DECLARE @Result int

EXEC @Results = spUpdateFile 51,'SAAG.PDF','\CompassFileUpload\','Solutions-At-A-Glance','','51SAAG.PDF', 0

PRINT @Results

--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCITP: Database Administrator
MCTS: SQL Server 2005
http://sqllearnings.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-12 : 02:32:40
quote:
Originally posted by -Dman100-

I'm trying to debug a stored procedure in Query Analyzer and determine why I keep getting an incorrect result back.

How do I print the result to the screen and execute the stored procedure.

This is what I was trying:

DECLARE @result int
SET @result = EXEC spUpdateFile 51,'SAAG.PDF','\CompassFileUpload\','Solutions-At-A-Glance','','51SAAG.PDF', 0
PRINT @result

Incorrect syntax near the keyword EXEC

Thanks for any help.


Did you use output variable in the procedure?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-12 : 13:28:42
http://www.sqlteam.com/article/stored-procedures-returning-data
Go to Top of Page
   

- Advertisement -