Capturing table name when parsing sql statement. 
Author Message
 Capturing table name when parsing sql statement.

Lets say that I have an sql that look like this:

insert into test1 select * from test;
update test2 set col1 = 1;

I want to capture the name of the tables that are going to be modified
(update, insert or delete) without executing the sql statement. So that
I can make a copy of these tables before I execute the modifcations.

1. Is there a way to capture the names of  these tables when the sql is
parsed.

2.  Can I parse the sql without executing it.

Thanks !!

Sent via Deja.com http://www.***.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT
 Capturing table name when parsing sql statement.

copying tables is almost certainly not the thing you want to do for each
update.

This sort of thing is done with a trigger.
Create an update trigger that copies the old data to a holding table
before the commit.

or just dont commit...

are you worried about data integrity?  are you debugging SQL in the live
database?

use a test database with triggers as above to solve your problem.. i
think.

Hth,
Randy

Quote:

> Lets say that I have an sql that look like this:

> insert into test1 select * from test;
> update test2 set col1 = 1;

> I want to capture the name of the tables that are going to be modified
> (update, insert or delete) without executing the sql statement. So that
> I can make a copy of these tables before I execute the modifcations.

> 1. Is there a way to capture the names of  these tables when the sql is
> parsed.

> 2.  Can I parse the sql without executing it.

> Thanks !!

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Use constant or variable as table name in sql statement

2. SQL Statement - Including the Table Name

3. SQL Statement When Table Name Contains Two Words

4. what sql statement will return all table names in db

5. SQL statement to check table names

6. Use Variable as Table name in EXEC SQL statements (ESQL/C)

7. How do I parse name into first and last name fields

8. variable for table name in CREATE TABLE statement

9. Tools to capture SQL statement

10. Capturing SQL Server Print statements

11. Capture SQL Statement from within trigger

12. How can we capture each sql statement error on the DB


 
Powered by phpBB® Forum Software