SQLTeam.com | Weblogs | Forums

How can I denote all the columns in a table?

Hello!

I want to search for a value in any column of a specific table.

I plan to do:
SELECT *
FROM Table1
WHERE [here I need to put any column] = 'value'

Is there an easy way to denote [any column in the table]?

I was thinking something like 1-999 columns or something?

Thanks!

Please stop posting same question multiple times. See previous posts and answers?

hope this helps

SELECT 
       ' SELECT * FROM ' ,
       o.name ,
    '  WHERE  ', c.name , ' = 89 '
    FROM 
          sys.objects o
    INNER JOIN 
        sys.columns c ON c.object_id = o.object_id
    WHERE 
        o.type_desc IN ('USER_TABLE')
    ORDER BY 
         1, c.column_id
1 Like