November 6, 2013 at 6:56 am
Hi,
I have the following part in my Select statement -
Select CASE WHEN dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] = '1'
THEN 'yes'
ELSE dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] END AS 'on-tncy',
I get the error - Conversion failed when converting the varchar value 'yes' to data type tinyint.
Now I presume I need to convert dbo.[IH_RE-TNCY-PERSON].[ON-TNCY], but I'm unsure how to do this correctly.
Thanks
November 6, 2013 at 7:00 am
Ryan Keast (11/6/2013)
Hi,I have the following part in my Select statement -
Select CASE WHEN dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] = '1'
THEN 'yes'
ELSE dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] END AS 'on-tncy',
I get the error - Conversion failed when converting the varchar value 'yes' to data type tinyint.
Now I presume I need to convert dbo.[IH_RE-TNCY-PERSON].[ON-TNCY], but I'm unsure how to do this correctly.
Thanks
Try: -
SELECT
CASE WHEN dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] = '1' THEN 'yes' ELSE CAST(dbo.[IH_RE-TNCY-PERSON].[ON-TNCY] AS VARCHAR(3)) END AS 'on-tncy',
November 6, 2013 at 7:13 am
Thanks. Worked perfectly.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply