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)
 Execute Procedure

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-04-28 : 17:33:24
Hello,

I created an Update procedure.
From within this procedure I need to execute the procedure named syncronize which has Id and Text as inputs and Feedback as output:

...
@Id UNIQUEIDENTIFIER,
@Text NVARCHAR(MAX),
@Feedback INT OUTPUT
...
SELECT @Feedback = @@ERROR
...

Then I need to make the variable OUT in Update equal to the output value of @Feedback after I call the Synchronize procedure.

What is the right way to do this?

Thank You,
Miguel

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-04-28 : 18:23:02
could you provide a bit more code that shows what are you trying to do exactly?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-04-28 : 19:27:58
Hi,

Basically I have an update procedure:

ALTER PROCEDURE [dbo].[UpdateUser]

@UserId UNIQUEIDENTIFIER,
@UserName NVARCHAR(512),
@UserEmail NVARCHAR(512),
@Feedback INT OUTPUT

AS
BEGIN

SET NOCOUNT ON

-- Update user
UPDATE dbo.Users
SET
UserName = @UserName,
UserEmail = @UserEmail
WHERE UserId = @UserId

SELECT @Feedback = @@ERROR

>> HERE I want to execute the procedure synchronize which has 2 inputs: @Id (UserId), @Text (UserName) and 1 output @Feedback

END

I could place the code of that procedure in "HERE" but because that code is used in various situation I prefer to place it in a different procedure and execute when it is needed.

Can't I do this?

Thank You,
Miguel
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-04-29 : 10:42:11
i don't see why not.
have you tried it and are you not getting what you expected?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -