Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can i use case to set a varaible? 1

Status
Not open for further replies.

stephenk1973

Technical User
Jun 11, 2003
246
GB
Am trying to write a stored procedure..

Sort of....

SELECT CASE @prmFlag
WHEN 'O' THEN
(select @prmTDate = @prmTDateOpen )
WHEN 'C' THEN
(select @prmTDate = @prmTDateClose )

END

Does not like the select ( or set)

All advice much appreciated.

Kind regards

Stephen
 
Try:
Code:
SET @prmTDate = CASE @prmFlag
                     WHEN 'O'  THEN @prmTDateOpen 
                     WHEN 'C'  THEN @prmTDateClose
                ELSE
                     NULL 
                END

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top