Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 covert

Author  Topic 

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2007-12-11 : 22:06:03
Hi Guys,


Can you help me.. I want to convert this table
From
No. LineNo
01 3
02 0

To
No. LineNo
01 03
02 00

What query should I do?


Thanks,

DUDZ

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-11 : 22:07:32
what is the data type for column LineNo ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2007-12-11 : 22:13:02

I execute this query to first then after this is the conversion of the line number. Datatype is smallint

'LineNO' = isnull(C.[LineNo],'0'),
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2007-12-11 : 22:20:52
datatype is smallint
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-11 : 22:23:15
[code]right('00' + convert(varchar(10), isnull(c.[LineNo], 0)), 2)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2007-12-11 : 22:54:19
Thanks..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-12 : 01:23:56
Formation matters mostly in front end

Other method

replace(str(coalesce([Line_no],0),2),' ','0')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -