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.
| Author |
Topic |
|
jimdarter
Starting Member
14 Posts |
Posted - 2010-05-10 : 16:13:03
|
| Dear All, I have a database which has only ONE table and I want to write a query that will search for any keyword that has been entered by the user on a web-front interface. Can you pls help me with this? Your help is highly appreciated. Thank you. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jimdarter
Starting Member
14 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jimdarter
Starting Member
14 Posts |
Posted - 2010-05-10 : 16:28:12
|
quote: Originally posted by tkizer DECLARE @SomeVar varchar(50)SET @SomeVar = 'SomeString'SELECT * FROM YourTable WHERE SomeColumn1 LIKE '%' + @SomeVar + '%' OR SomeColumn2 LIKE '%' + @SomeVar + '%' OR...You can loop through the columns in INFORMATION_SCHEMA.COLUMNS, however it would be better to hard-code each of them. You only want to search through the character data.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
I think that is a good way to do it but I don't know if it will work for the columns that are Integer based. Let me try it though. Thanks for the suggestion. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|