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
 General SQL Server Forums
 New to SQL Server Programming
 Run a SQL query only on new records?

Author  Topic 

pmoran
Starting Member

1 Post

Posted - 2010-03-05 : 11:42:58
Hi,

I dont have much SQL experience but i need to insert a trigger into a table but there is about 10 million records and it seems to run through all the old records when i only want it to insert the trigger and run it on any new records not the 10 million old ones, it was taking hours

-- Trigger: f_tscrec1_trigg on playercolumns

-- DROP TRIGGER f_tscrec1_trigg ON playercolumns;

CREATE TRIGGER f_tscrec1_trigg
BEFORE INSERT
ON playercolumns
FOR EACH ROW
EXECUTE PROCEDURE f_tscrec1('tscrec');

So i just want it to insert the trigger now and everytime it inserts a new record run the trigger, its fine on smaller databases but on bigger ones its a disaster. Any ideas, as i said im a newbie to SQL? Im just inserting this via PGadmin in the SQL query tool so its postgreSQL but i presume the SQL query is universal?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 11:45:41
is this SQL Server? I dont think so seeing syntax

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-03-05 : 11:59:37
quote:
Originally posted by visakh16

is this SQL Server? I dont think so seeing syntax

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





quote:

Im just inserting this via PGadmin in the SQL query tool so its postgreSQL but i presume the SQL query is universal?



It is postgreSQL

PBUH
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 12:02:22
Ok then suggest you try this at www.dbforums.com

This is MS SQL Server forum

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -