sql server - Making an SQL prodedure to add characters to a string -
hi i'm trying create procedure in sql adds bunch of zeroes string finish length 18 characters example:
0446793932' ====> '000000000446793932
and procedure go within update command,
update table set variable = prototype_procedure('0446793932') .......
i don't know much sql or procedures, if guide me through help me understand, appreciate,
you can utilize replicate function accomplish want.
http://msdn.microsoft.com/en-us/library/ms174383.aspx
declare @t nvarchar(10) = n'0446793932' select @t, replicate(n'0', 18 - len(@t)) + @t
sql sql-server sql-server-2008
No comments:
Post a Comment