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
 select top 1 in SS 2000

Author  Topic 

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-09-04 : 15:47:14
If I run a query like "Select fsono from Inserted" and this query may have more than 1 record, how can I only pull the first fsono? Does Top work in 2000?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-04 : 16:02:31
Yes TOP works in SQL Server 2000. How about trying it?

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

Subscribe to my blog
Go to Top of Page

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-09-04 : 16:14:44
Alright, I feel like an idiot. I used the wrong syntax for it, did a google search, and got the impression that it was 2005+.

SELECT TOP 1 (FSONO) FROM INSERTED

That seems to work.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-04 : 16:16:13
Remember that you don't know which one is first unless you specify an ORDER BY.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -