1. There’s a
table with below data.
Query:
declare @employee as table(
id int
)
insert into @employee values(1)
insert into @employee values(20)
insert into @employee values(300)
insert into @employee values(4000)
insert into @employee values(50000)
insert into @employee values(600000)
select * from @employee
select replicate('0',6-len(id)) + cast(id as varchar) from @employee
Query:
declare @employee as table(
id int
)
insert into @employee values(1)
insert into @employee values(20)
insert into @employee values(300)
insert into @employee values(4000)
insert into @employee values(50000)
insert into @employee values(600000)
select * from @employee
select replicate('0',6-len(id)) + cast(id as varchar) from @employee
No comments:
Post a Comment