Using Select Command In cursor on TempTable in a Trigger

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a trigger which uses temp table using # and inserts some data
selecting from other tables .

After insertion I want to make some calculations in an order of datetime. SO
I use Cursor to select each row and perform some calcutations and insert back
to temp table #.


After insertion I use some validations.

No issues so for. To My surpirse I read in Books Online SQL that we can use
select statement on Temp Tables in a trigger.

Will I have any future problems

Thanks in advance

R.D
 
Hi

I have a trigger which uses temp table using # and inserts some data
selecting from other tables .

After insertion I want to make some calculations in an order of datetime. SO
I use Cursor to select each row and perform some calcutations and insert back
to temp table #.


After insertion I use some validations.

No issues so for. To My surpirse I read in Books Online SQL that we can use
select statement on Temp Tables in a trigger.

Will I have any future problems

Only this - make sure that any table you insert into doesn't have an IDENTITY
column if it will fire on insert via an ADO recordset with a client-side
cursor (requried for an ADP editabe form) or via a DAO recordset. In both of
these cases, the driver will think the @@IDENTITY value produced by the
trigger action belongs to the new record in the table it was trying to insert
into, and it will think the new record could not be found.
 
Hi Steve

I think i did not make it clear. I used T_SQL cursor in a trigger.


Trigger fires and inserts data into temptable. The calculations are done in
that temp table by using cursor and the calculated values are inserted back
to temp table in that cursor.

In the books online it is given that we CANT select records from temptable
in using cursor . is IT SO. but it is working fine for me.

all tables have identity columns and defaults are inserted implicitly

any help

R.D
 
Back
Top