•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,688 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,377 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 916 | Replies: 1 | Solved
•
•
Join Date: Apr 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
can anyone tell me how to use a variable table name in select syntax??
like..select * from tablename
here tablename is a variable name ..i read tht it can be done using dynamic sql..but i am not able to do it..can anyone tell me the code for it...i tried writin a procedure like this..
is this right?? or am i doin any syntax or semantic error??
like..select * from tablename
here tablename is a variable name ..i read tht it can be done using dynamic sql..but i am not able to do it..can anyone tell me the code for it...i tried writin a procedure like this..
sql Syntax (Toggle Plain Text)
CREATE procedure vartable(tablename varchar(255) begin declare varsql varchar(4000); varsql='select * from tablename'; exec(varsql); end;
is this right?? or am i doin any syntax or semantic error??
Last edited by peter_budo : Apr 17th, 2008 at 3:12 pm. Reason: Keep It Organized - please use [code] tags
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: help for log files
- Next Thread: key problem



Threaded Mode