May 13, 2008 at 4:54 am
Hi,
I am trying to convert an integer to text in a query using:
CASE WHEN [Extension]<'80' THEN '0' + CAST( Extension AS text(12)) ELSE [Extension] END AS Extn
but I get the following error:
'Explicit conversion from data type int to text is not allowed'
Any suggestions? I dont want to convert the Table
May 13, 2008 at 5:07 am
Use varchar rather than text?
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
May 13, 2008 at 5:16 am
Hi,
The '0' is not added when I use varchar
May 13, 2008 at 5:19 am
hi
Try this
CASE WHEN [Extension]<'80' THEN '0' + CAST( Extension AS varchar(12)) ELSE [Extension] END AS Extn
May 13, 2008 at 5:23 am
It must be [Extension]<80, not [Extension]<'80' .
_____________
Code for TallyGenerator
May 13, 2008 at 5:30 am
Still no luck
May 13, 2008 at 5:46 am
Try This
CASE WHEN [Extension]<80 THEN '0'+ CAST(Extension as VARCHAR(12)) ELSE CAST(Extension as VARCHAR(12)) END AS Extn
May 13, 2008 at 5:56 am
Thank you all it works
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy