Don't you need to have '3' and not 3 as it is a varchar?
PAYCHEX
Christopher Bellizzi
Information Technology * Database Administration
675 Basket Road * Webster, New York 14580
(585) 216-0670 * [Email address protected]
-----Original Message-----
From: Clint Nash
[mailto:mssqldba-ezmlmshield-x9946530.[Email address protected]
Sent: Thursday, September 27, 2007 7:53 PM
To: LazyDBA Discussion
Subject: 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.
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
-----------------------------------------
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
Thank you. Paychex, Inc.
MS Sql Server LazyDBA home page