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

Hope this helps :
try bigint instead of int

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.