Friday, February 24, 2012

add digits to the front

Hi all,
I have a number like so 778625 and want to make this a more meaningful
date (UK) so how difficult is it to add two digits in this case 19 to
the front of this number?

Many thanks
Sam

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!actually i don't need it to be a date i just need to add 19 to the front
of the number.
Thanks again
Sam

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||You can do:

SELECT CAST(CAST(19 AS VARCHAR) + CAST(778625 AS VARCHAR) AS INT)

Another option is to do:

SELECT 19 * POWER(10, LEN(778625)) + 778625

--
- Anith
( Please reply to newsgroups only )|||Not really sure what you mean but something like

select convert(int,'19'+convert(varchar(10),fld))

--
Posted via http://dbforums.com

No comments:

Post a Comment