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 |
|
jamesbeal
Starting Member
5 Posts |
Posted - 2010-01-12 : 03:57:09
|
| Hi,I am running a SQL stored procedure that has been written by someone else for me and if I run it through SQL Query Analyzer is works fine but when I run it through my program via a ODBC it doesn't return a value it just returns the number of rows affected.The strange thing is that if I run a stored procedure which doesn't pass any variables it returns the value no problem.I have tried running the procedure using ODBCView and I get the same result.I know there isn't much info here but just wondered if anyone else had come across this issue.Below is the command I use to call the procedure:EXEC [RPA].[dbo].[getPdfFilenameNo] '12345', 'jamesisa'The procedure does a select and then updates if this helps?J Beal |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-01-12 : 04:01:39
|
| "it just returns the number of rows affected"If you putSET NOCOUNT ONat the top of the SProc code (just after the "AS" statement) that will stop it returning that "pseudo" resultset.To get a return value you will either have to do that programatically - calling the Sproc using a parameterised query from your application language, rather than dynamic SQL, or you will have to output the Return Value as another resultset - e.g. by adding:SELECT @TheReturnValue AS MyReturnValueat the very end of the sproc, and then using using some sort of GetNextResultSet() function in your application (ODBCVIew should display that for you) |
 |
|
|
|
|
|