0

I am using sqlserver 2012. i want to convert nvarchar value from a table in to an integer. How can i do it? i am using it in a stored procedure. and nvarchar value only contains numbers.
What i want to do is to multiple that nvarchar value and assign it to int variable.. When i tried it Following error comes

Select @temp = @nvarcharvalue * 2

I also tried.

 Select @temp = CAST(@nvarcharvalue as int)* 2

Following error is shown.

The conversion of the nvarchar value '20130429044221' overflowed an int column.

How can it be done?
Thanks in advance

2
Contributors
1
Reply
9
Views
4 Years
Discussion Span
Last Post by edmond.lohman
0

Hope this helps :
try bigint instead of int

This workts with me :
declare @temp bigint
set @temp=20130429044221;
set @temp=@temp + @temp
select @temp

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.