Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
2.47/5 (4 votes)
See more:
Hi everyone

I found this article which was the best and almost solved my problem,
but the problem occurred when I tried the same for searching within my site.

The problem occurred when I searched for a name and it showed the username and password tables.

How can I select specific tables for the search?

Also how can I get the list of tables based on the search and also a unique id (this unique id I want to use to restrict one user search to with the other user)

Thank You
Posted
Comments
George Jonsson 16-Oct-14 5:25am    
To specify the table name you could add an in-parameter, @TableName nvarchar(100), to the stored procedure and remove the variable declared inside the SP. Also remove the 'SET @TableName ' statement inside the outer loop.
Maciej Los 16-Oct-14 16:18pm    
On what question do you expect an answer?
1) How to search all columns of selected tables in a database?
or
2) How can I select specific tables for the search?
JPais 17-Oct-14 15:17pm    
Through the article I was able to get all tables, I want to know whether it is possible if I can specify tables for the search and also how can I get the list of tables based on the search and also a unique id (this unique id I want to use to restrict one user search to with the other user)
Thankyou

Try this,
SQL
select TABLE_NAME from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='pass_unique_columnname_here'

(or)
SQL
select * from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='pass_unique_columnname_here'
 
Share this answer
 
v4
Hi,

SQL
select * from INFORMATION_SCHEMA.COLUMNS where Table_Name=@tableName



Thanks
Dinesh Sharma
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900