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)
 How to return value in stored procedure

Author  Topic 

krishnet
Starting Member

29 Posts

Posted - 2007-06-05 : 05:38:58
Hi,

Using SQLSERVER 2005

I want to return the value in the stored procedure.

How can i return the value in the stored procedure ?


SELECT
FROM dbo.account
WHERE accountid = @accountid


--select @@RETURNVALUE = @accountid

I want that by default the value of @accountid should return the value...............

What i want is don't want to use WHERE accountid = 2
but the 2 returns itself..
Is it possible ??
I have read that::
You can also return the values from stored procedure using output variables.Stored procedure doesnot returns value where as function returns value." if u call procedure inside storedprocedure then u can return multipal values"..
Thanxs

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-05 : 05:41:29
Not clear what you want.

May be this:

SELECT @accountid as AccountID


or define @accountid as OUTPUT parameter.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-05 : 09:24:45
Read about output parameter in sql server help file
Also, if you use input paramter you need to supply it's value when executing

Madhivanan

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

- Advertisement -