sql server - Losing leading 0 from stored procedure -
i trying right zip code city , state values. losing leading 0s zip code.
example
create procedure sp_getcorrectvalue begin declare @value nvarchar(5) set @value = '00254' homecoming @value end declare @getvalue nvarchar(5) exec @getvalue = sp_getcorrectvalue select @getvalue zipcode
it should homecoming 00254
, returns 254
not correct
please help thanks
you should create function
create function fn_getcorrectvalue() returns nvarchar(5) begin declare @value nvarchar(5) set @value = '00254' homecoming @value end
demo @ http://sqlfiddle.com/#!3/29fa9/1/0
stored procedures homecoming integer (http://msdn.microsoft.com/en-us/library/ms174998.aspx)
stored procedures can homecoming integer value calling procedure or application
sql-server sql-server-2008
No comments:
Post a Comment