Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert varchar

Author  Topic 

kt
Yak Posting Veteran

88 Posts

Posted - 2013-04-01 : 18:17:21
Hi,

why am i still getting error message for"Conversion failed when converting the varchar value 'SM485695' to data type int.

select *
from dbo.tbl1 as t1
left join dbo.tbl2 as t2
on convert(varchar(50),t1.saleNo) = t2.saleNo

Thanks

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-01 : 18:44:11
Because SM485695 can't be converted to an INT.

-Chad
Go to Top of Page

kt
Yak Posting Veteran

88 Posts

Posted - 2013-04-01 : 18:55:53
what should i do?

thx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-02 : 01:25:25
avoid implicit/explicit conversion to int. Check for any such instances in your code and cast int values to varchar explicitly in those places.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -