Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Select top 5 results and update into one Column of another table


Message #1 by stephen.trigg@p... on Tue, 29 Jan 2002 11:41:03
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1A91E.EDBCF502
Content-Type: text/plain;
	charset="iso-8859-1"

Sorry, I just reread the original post and realised what you wanted to do.
Do you want to INSERT new records, or update current records? Your question
says you want to insert, but your code is showing UPDATE. To insert new
records:

CREATE TRIGGER UpdateWhatsNewPR
   ON intprDB.dbo.smiiprpress
   FOR INSERT, UPDATE
AS

INSERT INTO intprDB.dbo.TABLE1 (BodyS)
SELECT TOP 5 header
FROM intprDB.dbo.smiiprpress
Where release < GETDATE() order by release desc)
FROM intprDB.dbo.TABLE1, intprDB.dbo.smiiprpress

This might not be exactly what you want. From your code it what you were
trying to do wasn't apparent.

regards
David Cameron
nOw.b2b
dcameron@i...


  Return to Index