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 2000 Forums
 SQL Server Development (2000)
 SP: Using return value from select statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-13 : 08:03:17
Steven writes "SQL2000

Hi need help with the following. Need to run a stored proceedure to do the following.

1. Need to run a select statement on a table to get a value from the database.

2. Using this value I need the proceedure to decide which additional select statement needs to be run so I can get the results I require.

Done the following so far (new to writing SQL).

CREATE PROCEDURE job_details

@jobID int

AS
Begin
Declare @msgStatus varchar(255)
Set @msgStatus = (Select dbo.Texts_Sent.textID, dbo.Texts_Sent.messageReply FROM dbo.Texts_Sent WHERE dbo.texts_sent.textid = @jobID)

execute (@msgStatus)


IF @msgStatus="T"

(run chosen select statement)

IF @msgStatus="B"

(run chosen select statement)

End


GO"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-13 : 08:05:14
Did you get any error?

Madhivanan

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

- Advertisement -