I want to select the data from different table but the table should known at run time
How do i fetch data?
Please help me out of this..
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Akhil GargRank #772 · 3K reputationPosted Jan 27, 2015, 5:23 PM EST
You can pass table as a parameter and on the basis of that you can fetch data
EXEC('SELECT * FROM ' + @tablename)
Shubham Bhosale14 reputationPosted Jan 27, 2015, 6:21 PM EST