Conversion failed when converting the nvarchar value ?

Posted by Sudheep.grandhe under C# on 11/24/2011 | Points: 10 | Views : 1415 | Status : [Member] | Replies : 1
Hi,

select 0 as compaddress,'selectone' as compname union select compaddress,compname from dbo.tbl_report2 if i wrote this query it shows the following error.

Conversion failed when converting the nvarchar value

Best,
Sudheep.



Responses

Posted by: Vanajasethu on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
select '0' as compaddress,'selectone' as compname union select compaddress,compname from dbo.tbl_report2


0 within quotes will avoid the error since that column may be a nvarchar datatype, you are passing integer value



Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response