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 |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2008-11-12 : 17:13:17
|
| Hi,I'm trying to use an OUTPUT parameter to avoid bringing back a recordset altogether as its just 1 value I need brought back.The pagename value is what I want to retreive, but when I try executing this it doesnt seem to work. Am I doing something fundamentally wrong here ?For example this returns a NULL value in QueryAnalyzer, when expected output is something else.DECLARE @returnValue varchar(30)exec [select_linkSwap_myTrackingDomain_OwnershipPage] 1, @returnValueSELECT @returnValueAny help much appreciated !thanks again :)mike123CREATE PROCEDURE [dbo].[select_myTrackingDomain_OwnershipPage] ( @domainID int, @pageName varchar(30) OUTPUT )AS SET NOCOUNT ONSELECT @pageName = ownerShipCode + '.html' FROM [tblTrackingDomains] WHERE domainID = @domainIDGO |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-11-12 : 17:17:38
|
According to BOL you need to add OUTPUT to the parameters on the EXEC statementquote: Originally posted by mike123 Hi,DECLARE @returnValue varchar(30)exec [select_linkSwap_myTrackingDomain_OwnershipPage] 1, @returnValue OUTPUTSELECT @returnValue
You are familar with Books Online, yes? |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2008-11-12 : 17:28:59
|
| Hey Lamprey,Thanks that fixed it from QA (still having probs from .NET but I'll have to figure it out there). I should probably use books online more, I just installed BOL 2008 today, so will dive into it soon!cheers,mike123 |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-11-12 : 17:47:26
|
quote: Originally posted by mike123 Hey Lamprey,Thanks that fixed it from QA (still having probs from .NET but I'll have to figure it out there). I should probably use books online more, I just installed BOL 2008 today, so will dive into it soon!cheers,mike123
Yeah, you need to also set up your paramters in .NET as output too. I forget the syntax, but a search on your favorite search engine should get you the syntax. |
 |
|
|
|
|
|
|
|