Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Trigger DELETED table columns-> temptablevariable

Author  Topic 

sqldoubt
Starting Member

17 Posts

Posted - 2010-06-07 : 21:43:29
hi
can anyone tell me if it is possible to
get all columns of deleted table into a temp table variable (@T1).
If yes syntax? and then
psuedocode:
Select * from @T1 where columnname not int (date, auditkey)

how can i achieve this..Plz help.........
any input is appreciated

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-06-07 : 23:34:31
By deleted table you mean the "Deleted" table which exists only in Triggers or you mean a table which is getting dropped ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-08 : 02:42:11
For just the column names, you can get its definition this way: SELECT * INTO #temp FROM deleted WHERE 1<>1

I don't understand your WHERE clause in the pseudocode you posted.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-08 : 03:01:46
quote:
Originally posted by sqldoubt

hi
can anyone tell me if it is possible to
get all columns of deleted table into a temp table variable (@T1).
If yes syntax? and then
psuedocode:
Select * from @T1 where columnname not int (date, auditkey)

how can i achieve this..Plz help.........
any input is appreciated


Why do you want to do this?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sqldoubt
Starting Member

17 Posts

Posted - 2010-06-08 : 18:01:57
yeah deleted table of trigger only.
quote:
Originally posted by pk_bohra

By deleted table you mean the "Deleted" table which exists only in Triggers or you mean a table which is getting dropped ?

Go to Top of Page

sqldoubt
Starting Member

17 Posts

Posted - 2010-06-09 : 00:14:45
This is actually an application of another team that is already developed. and now i am working on integrating both applications.So that is existing defect. i am trying to face it with triggers.
quote:
Originally posted by madhivanan

quote:
Originally posted by sqldoubt

hi
can anyone tell me if it is possible to
get all columns of deleted table into a temp table variable (@T1).
If yes syntax? and then
psuedocode:
Select * from @T1 where columnname not int (date, auditkey)

how can i achieve this..Plz help.........
any input is appreciated


Why do you want to do this?

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page
   

- Advertisement -