Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
hi,

I want to make a query builder and I want to show my table and their column like this in asp.net with sql server and how to code entity part
EasyQuery - ad-hoc query builder for web-sites. Demo page.

but I am anble to do this kindly help me how to do this .


thanks
mohammad

What I have tried:

I used list box and checkbox list and make a view for fetch table name and column.
Posted
Comments
Maciej Los 8-Feb-16 13:50pm    
What's the problem? "I am enable to do this..." is not informative at all!
snorkie 8-Feb-16 15:11pm    
http://bfy.tw/49fS

Try this:
SQL
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
ORDER BY schema_name, table_name; 


Source for the above query can be found here:
SQL SERVER – Query to Find Column From All Tables of Database – Journey to SQL Authority with Pinal Dave[^]

Good luck!
 
Share this answer
 
you could do this
SQL
SELECT name  
FROM sys.tables 
WHERE OBJECT_ID IN ( SELECT id 
FROM syscolumns 
WHERE name like '%COlName%' )
 
Share this answer
 

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