Simple Case statement

Simple Case statement

 

  

Good Evening,



I have a very simple case statement that is driving me nuts, this should be
very simple, but every turn I take it errors out.



declare @newtend int

declare @ccnum varchar(50)

declare @tendertypeID int



set @ccnum = 3000000000000000

set @tendertypeID = 4



select @newtend = (select ID = CASE tendertypeID WHEN left(@ccnum,1) = 3
THEN 11 Else @tendertypeID end)



Basically all I am trying to determine is if the first digit of the @ccnum
parameter is a 3 then the value of the variable @newtendID needs to set = 11
otherwise it should be set to the value of @tendertypeID.



Thanks,

Clint.




MS Sql Server LazyDBA home page