Two methods as below, you may choose what suits in your requirement:
create table test (SNNO_NR nvarchar (8), ID int)
Insert into test Values
('5720990',268942),
('5720991',268943),
('5720992',268944),
('5720993',268945),
('5720994',268946),
('5720995',268947),
('5720996',268948)
update test Set SNNO_NR = '0' + SNNO_NR
Select * From Test
--OR
update test Set SNNO_NR = Right('00000000' + SNNO_NR,8) -- 8 is the size of the datatype
Select * From test
Drop table Test
No comments:
Post a Comment