Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7869449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:19:28+00:00 2026-06-03T01:19:28+00:00

This query works great in SQL Server 2005 and 2008. How would I write

  • 0

This query works great in SQL Server 2005 and 2008. How would I write it in SQL Server 2000?

UPDATE TOP 10 myTable
SET myBooleanColumn = 1
OUTPUT inserted.*

Is there any way to do it besides running multiple queries?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:19:31+00:00Added an answer on June 3, 2026 at 1:19 am

    To be honest, your query doesn’t really make sense, and I have a hard time understanding your criteria for “great.” Sure, it updates 10 rows, and doesn’t give an error. But do you really not care which 10 rows it updates? Your current TOP without ORDER BY suggests that you want SQL Server to decide which rows to update (and that’s exactly what it will do).

    To accomplish this in SQL Server 2000 (without using a trigger), I think you would want to do something like this:

    SET NOCOUNT ON;
    
    SELECT TOP 10 key_column
    INTO #foo
    FROM dbo.myTable
    ORDER BY some_logical_ordering_clause;
    
    UPDATE dbo.MyTable
    SET myBooleanColumn = 1
    FROM #foo AS f
    WHERE f.key_column = dbo.MyTable.key_column;
    
    SELECT * FROM dbo.MyTable AS t
    INNER JOIN #foo AS f
    ON t.key_column = f.key_column;
    

    If you want a simple query, then you can have this trigger:

    CREATE TRIGGER dbo.upd_tr_myTable
    ON dbo.myTable
    FOR UPDATE
    AS
    BEGIN
      SET NOCOUNT ON;
    
      SELECT * FROM inserted;
    END
    GO
    

    Note that this trigger can’t tell if you’re doing your TOP 10 update or something else, so all users will get this resultset when they perform an update. Even if you filter on IF UPDATE(myBooleanColumn), other users may still update that column.

    In any case, you’ll still want to fix your update statement so that you know which rows you’re updating. (You may even consider a WHERE clause.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a query which works great on my local SQL Server 2005.
I want to port this SQL query, which works just fine on SQL Server,
i have this sql query (below) and it works great but i need to
I am running an SQL query on a SQL Server 2008 database. The results
This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
I have problems running a dynamic LIKE statement in my project: this query works
I know this particular query works, as I tested it with unprepared, procedural methods.
I have this query which works correctly in MySQL. More background on it here
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this linq query that works well (although it may be written better,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.