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 2000 Forums
 Transact-SQL (2000)
 Update Top N record Problem

Author  Topic 

craigh999
Starting Member

10 Posts

Posted - 2004-08-27 : 07:54:40
Hi People

I am trying to update top N records of a table,

CREATE PROCEDURE [GetDataForOutput]

@vnAmount int

AS

UPDATE tempImport

SET status = 3

FROM (SELECT top @vnAmount * FROM TempImport ) AS t1

WHERE TempImport.id = t1.id


For some reason i cant pass the top value as a parameter! if i exchange the @vnamount to 10 say it works fine?

Any help much appreciated

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-08-27 : 07:57:42
This will help you...

http://www.sqlteam.com/item.asp?ItemID=233
Go to Top of Page

craigh999
Starting Member

10 Posts

Posted - 2004-08-27 : 08:11:26
thanks

appreciate it
Go to Top of Page
   

- Advertisement -