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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shubham BhosalePosted Jan 27, 2015, 11:21 PM
Akhil GargPosted Jan 27, 2015, 10:23 PM
You can pass table as a parameter and on the basis of that you can fetch data
EXEC('SELECT * FROM ' + @tablename)