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
 SQL Server Development (2000)
 Using LIKE command to compare two tables

Author  Topic 

rwsjbs
Starting Member

17 Posts

Posted - 2010-03-22 : 16:16:28
Thanks you for looking at my post.

I am trying to compare two tables using the LIKE command. Here are my variables:

ProductNumber that starts with 12345xxxxxx
The Vendor.AccountNumber is 12345

The first 4 to 6 characters in the ProductNumber always start with the Vendor.AccountNumber characters.

I have tried the following script (doesn't work):

where %ProductNumber LIKE Vendor.AccountNumber%

Could you please tell me how to cinsert the % in the LIKE command to compare the two columns?

Thank you,
Richard Scott



vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-03-22 : 16:30:55
[code]where ProductNumber LIKE RTRIM(Vendor.AccountNumber) + '%'[/code]
Go to Top of Page

rwsjbs
Starting Member

17 Posts

Posted - 2010-03-22 : 16:37:35
Thank you for the solution. This saved me a lot of time.

-Richard Scott
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-03-22 : 16:40:59
Np. You're welcome.
Go to Top of Page
   

- Advertisement -