In PL/SQL we have the statement LPAD(string, length, pad), RPAD(string, length, pad)Returns string padded on left or right to length characters using the pad string as padding. Here is an example that provied the similar functioanlity in sql server
declare @in_val int
set @in_val = 1
select 'R'+right(replicate('0',3)+CAST(@in_val AS VARCHAR),2)
If you pass 1 as input val this will return 'R01' , for value 10 this will return 'R10'
Friday, June 19, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment