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 |
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2009-03-16 : 09:17:48
|
HiI guess this is a simple task but I need some help to call a sp inside another sp. The sp I would like to call looks like this..p_UID@RandomNumber nVarchar (50),@RandomUID int output And the actual sp should look something like this..DECLARE @OrderID intSET @OrderID = EXEC p_GetUID(@RandomNumber, @RandomUID OUTPUT) -- some other processRETURN @OrderID But I get errors on the set part, so I gues something is wrong with my code. |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-03-16 : 09:28:39
|
| you sure p_GetUID is going to return a single number? make it a function. |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-03-16 : 09:43:32
|
| [code]EXEC @OrderID = p_GetUID(@RandomNumber, @RandomUID OUTPUT)[/code] |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2009-03-16 : 09:50:18
|
| when using this..@RandomNumber nVarChar(50),@Adress1 nVarChar(50),@Adress2 nVarChar(50),@Adress3 nVarChar(50),@Adress4 nVarChar(50),@Adress5 nVarChar(50),@Adress6 nVarChar(50),@Adress7 nVarChar(50),@Adress8 nVarChar(50),@Adress9 nVarChar(50),@CustID Int,@NodeID Int,@Qty Int,@FileName nVarChar(100)ASBEGINSET NOCOUNT ON;DECLARE @OrderID intEXEC @OrderID = p_GetUID(@RandomNumber, @RandomUID OUTPUT)I get this error..Incorrect syntax near '@RandomNumber'. |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-03-16 : 13:44:17
|
Probably because you have not declared @RandomUID. You will need something likedeclare @RandomUID varchar(128); if the datatype of @RandomUID is varchar(128) in the stored procedure. Also, if the stored procedure expects a value for @RandomUID, you will need to initialize that as well. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-16 : 13:49:26
|
quote: Originally posted by magmo when using this..@RandomNumber nVarChar(50),@Adress1 nVarChar(50),@Adress2 nVarChar(50),@Adress3 nVarChar(50),@Adress4 nVarChar(50),@Adress5 nVarChar(50),@Adress6 nVarChar(50),@Adress7 nVarChar(50),@Adress8 nVarChar(50),@Adress9 nVarChar(50),@CustID Int,@NodeID Int,@Qty Int,@FileName nVarChar(100)ASBEGINSET NOCOUNT ON;DECLARE @OrderID intEXEC @OrderID = p_GetUID(@RandomNumber, @RandomUID OUTPUT)I get this error..Incorrect syntax near '@RandomNumber'.
what does p_GetUID do? does it return a integer value? also the braces are not requiredEXEC @OrderID = p_GetUID @RandomNumber, @RandomUID OUTPUT |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2009-03-16 : 14:49:46
|
| Hi visakh16It returns a Integer value |
 |
|
|
|
|
|
|
|