find text from another table

  • I need to do a query or join from two tables, but rather than a straight equal, I need SQL to "search" the field looking for text from the other table.

    I have:

    Table a:

    TableName SQL

    A CREATE INDEX [idx_account_id] ON [dbo].[COUNTY] ( [ACCOUNT_ID] ASC ) WITH ( PAD_INDEX = ON, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF ,FILLFACTOR = 60 ,DROP_EXISTING = ON ) ON [PRIMARY]

    In table b I have:

    Table Column

    A ACCOUNT_ID

    I need to do a query or join from tableb.column to tablea.sql.

    I was thinking of

    SELECT * FROM tablea, tableb where tablea.tablename = tableb.tablename and CHARINDEX(strcolumn,IndexCreateSQL)>0

    But that does not work.

  • I think I see the problem, somehow the column name has extra spaces, so I just added rtrim in the charindex.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply