Click here to Skip to main content
13,510,356 members
Rate this:
Please Sign up or sign in to vote.
I have a table in SQL in which I inserted my other table names. There is a Table names column. So, is it possible (programmatically inside SQL) getting the table names from this column and use them in stored procedure as table name? How? inside SQL. thanks
Posted 12-Mar-13 12:42pm
Updated 12-Mar-13 12:57pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It's uncommon but it's possible.

The magic beans you are looking for is called a prepared statement[^].

You could query your table-table for a table name and assign that to a variable and then construct the SQL for the prepared statement on-the-fly.

See The Curse and Blessing of Dynamic SQL[^]
Sergey Alexandrovich Kryukov 12-Mar-13 19:25pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 12 Mar 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100