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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Number Conversion

Author  Topic 

ucal
Yak Posting Veteran

72 Posts

Posted - 2008-04-08 : 14:43:06
I want to Convert the following :
XX
--
1
2
3
4
5
6
7
8
9
10
11
12
13


To

NewXX
-----
01
02
03
04
05
06
07
08
09
10
11
12
13

Any help will be welcommed

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-08 : 14:45:11
UPDATE Table1
SET Col1 = RIGHT('00' + Col1, 2)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ucal
Yak Posting Veteran

72 Posts

Posted - 2008-04-08 : 14:47:56
Thanks Peso
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-09 : 02:52:47
quote:
Originally posted by Peso

UPDATE Table1
SET Col1 = RIGHT('00' + Col1, 2)



E 12°55'05.25"
N 56°04'39.16"



If it is only two digits, you need only one zero

UPDATE Table1
SET Col1 = RIGHT('0' + Col1, 2)


Madhivanan

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-09 : 02:54:20
quote:
Originally posted by ucal

I want to Convert the following :
XX
--
1
2
3
4
5
6
7
8
9
10
11
12
13


To

NewXX
-----
01
02
03
04
05
06
07
08
09
10
11
12
13

Any help will be welcommed


Where do you want to show the data?

Madhivanan

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

ucal
Yak Posting Veteran

72 Posts

Posted - 2008-04-09 : 09:08:48
Madhivanan, I was updating the contents of a table.

Thanks for you response
Go to Top of Page
   

- Advertisement -