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.
| Author |
Topic |
|
fizgig
Starting Member
34 Posts |
Posted - 2004-05-19 : 03:04:36
|
Hi,Why doesn't this stored procedure return a value? When debugging the stored procedure @size has values larger than 0. Thank you for your help.CREATE PROCEDURE getMailBoxSize@id int ASDECLARE @size intDECLARE @send intDECLARE @received intSELECT @send = SUM(mailSize) FROM mailSend WHERE userId = @idSELECT @received = SUM(mailSize) FROM mailReceived WHERE userId = @idSELECT @size = CAST(COALESCE(@send, 0) + COALESCE(@received,0) as int)RETURN @sizeGO |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-05-19 : 03:57:10
|
Looks fine to me. How are you capturing the return value, presumably using ADO at your front end? Try checking it in query analyzer first:declare @retval intexec @retval = getMailBoxSize 1202 --supply a real id hereprint @retval OS |
 |
|
|
fizgig
Starting Member
34 Posts |
Posted - 2004-05-19 : 04:04:14
|
Ah, thank you. I did use the query analyzer, but like this:getMailBoxSize 1202 |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-05-19 : 04:55:27
|
| Not a good idea to use the return value for data, save it for error codes - better to use an output parameter.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|