July 11, 2008 at 2:55 am
I want to search any string from all columns of a table
something like this:
select * from tablename where *(all column) like ('%searchstring%')
Please help.
July 11, 2008 at 9:38 am
How about the script below?
SELECT * FROM syscolumns WHERE id=OBJECT_ID('Orders') WHERE name LIKE '%ID%'
You need to replace the table name, Orders, by yours.
July 11, 2008 at 9:45 am
You could do it a couple of ways. You could concatenate all the columns in the table and then use LIKE. You could use "OR". If you are searching like this on a regular basis you could create a computed column that concatenates all the character columns in the table.
I have to ask why you need to search like this also.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply