Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Let's say I have a table with SQL statements in a column. I want to execute them all. create table sql_command( sql_text text ) I know how to execute one SQL statement using EXEC, but I wa...
#2: Post edited
Execute sql from select
- Execute SQL queries stored in a table
Lets say I have a table with SQL statements. I want to execute them all.```- create table sql_command(
- sql_text text
- )
- ```
I know how to execute one SQL statement using `EXEC`, but I want to do it for all statements in database.`exec (sql_command) from (select sql_text from sql_command)` don't work.
- Let's say I have a table with SQL statements in a column. I want to execute them all.
- ```sql
- create table sql_command(
- sql_text text
- )
- ```
- I know how to execute one SQL statement using `EXEC`, but I want to do it for all statements in the table.
- `exec (sql_command) from (select sql_text from sql_command)` doesn't work.
#1: Initial revision
Execute sql from select
Lets say I have a table with SQL statements. I want to execute them all. ``` create table sql_command( sql_text text ) ``` I know how to execute one SQL statement using `EXEC`, but I want to do it for all statements in database. `exec (sql_command) from (select sql_text from sql_command)` don't work.