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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 CONVERT/CAST in Join statement???

Author  Topic 

Maria
Starting Member

12 Posts

Posted - 2001-11-28 : 07:28:50
Hello,

i want to join 2 tables on an ID column, but the one table stores the ID column as varchar and the other table as integer. i want to convert the varchar to integer during the join of the tables to return certain results. any ideas on how to incorporate this function into the join?

thanks

Maria

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2001-11-28 : 07:43:21
Doesn't this work?
SELECT * FROM T1 INNER JOIN T2 ON CONVERT(int, T1.ID) = T2.ID


Go to Top of Page

Maria
Starting Member

12 Posts

Posted - 2001-11-28 : 12:17:05
Yes! it does...

the problem was with both my logic and my syntax i'm afraid. I have managed to get it working.

Thanks v. much ^_^

Maria

Go to Top of Page
   

- Advertisement -