How to match sql Query following Scenario

Posted by Jayakumars under ASP.NET on 7/5/2013 | Points: 10 | Views : 627 | Status : [Member] [MVP] | Replies : 1
hi

I have both table
table1 id-int
table2 testId-varchar


how to match both column

now i try to modify column testid to int
did not changed here i have data in my table how to match convert int
most urgent

my query this
================
cast(id as int)=cast(testid as int)

Mark as Answer if its helpful to you


Responses

Posted by: Jitendrasoft09 on: 7/5/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Jay,

In the code only testid needs to convert not id, it works as below code, if you are writing in stored procedure, need to use declare keyword to convert.

SELECT * FROM table1 T1 INNER JOIN table2 T2 ON  T1.id=cast(T2.testid as int);


Refer below link-

http://stackoverflow.com/questions/7973224/how-to-convert-varchar-to-int-in-sql-server-2008

Hope you are clear.

Jitendra Kumar
If my post helps you, plz mark as an answer.

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

Login to post response