Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
hi...

could anyone suggest me how can we generate SQL query dynamically in a web application. Actually i m designing a application in which a user can have the freedom to view the database information with his choice of columns and conditions But i dont know how to achieve this.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Nov-11 21:09pm    
Not a question. Which of the techniques you don't know? If so, what "I'm designing an application" means?
--SA
[no name] 27-Nov-11 21:12pm    
Next time, be specific on your question. We can't give you all the details you need on this one.

Hi,

I have already created an application similar to this.

Like for example viewing the tables looks like this:
SQL
USE [DBNAME];
SELECT table_name FROM INFORMATION_SCHEMA.TABLES

For stored proc:
SQL
USE [DBNAME];
SELECT specific_name FROM INFORMATION_SCHEMA.TABLES


etc...... Google can be your friend here :)

All you need to do here is to concat each lines and use some of it as parameters to make it dynamic.

Regards,
Eduard.
 
Share this answer
 
v2
hi sidhu,
Dynamic Sql Query[^]
 
Share this answer
 
 
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