GoodMorningSky
Junior Member
 
122 Posts |
Posted - 07 October 2003 : 21:29:50
|
select Right('000' + Convert(char(3), FS.STORE_ID), 4) as stid FROM STORES as FS
STORES table contains STORE_ID as char(3). But, I need it as char(4) with preceeding '0's. So, I expect the above query returns all stid with '####' 4 digit char. However it returns 3 or 4 digit.
I tried this too.
select Right('000' + Convert(char(3), FS.STORE_ID), 4) as st FROM STORES as FS
But, same problem..
I used (case when Len(fs.store_id) = 2 then '00' + fs.store_id when Len(fs.store_id) = 3 then '0' + fs.store_id ELSE fs.store_id End) instead of rigth(). it retruns as I expected..
What is problem with Right function in T-SQL?
Thank you.. |
Software Engineer. MCSD.NET, SCWCD |
|