August 27, 2008 at 3:14 pm
my query is in this sturcture
declare @number numeric(10,0)
set @number =(select distinct Number from tablename where conditions)
select @number
how to appent 00 while displaying number
August 27, 2008 at 3:22 pm
try a shot
declare @number varchar(10)
set @number =(select distinct Number from tablename where conditions)
select '00'+ @number
August 28, 2008 at 1:23 am
This is not easy for a numeric value, because you have to code '00'+@number everywhere in your code (see post of Nary). Better to convert to a string.
declare @number char(10)
set @number = '00' + CAST((select distinct Number from tablename where conditions) AS Char)
select @number
Now you only code '00' + @number once and you can just use @number on all other places in your code.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply