DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
SITE SEARCH SQLUSA.com HEADLINES NEWS
SQL E/BOOKS   SQL 2014 PROGRAMMING   DOWNLOADS
SCRIPTS SQL 2005 SQL 2008 ARTICLES
SQL JOBS TWITTER FORMAT VIDEOS
How to apply the TOP clause with UPDATE?

Execute the following Microsoft SQL Server T-SQL script to give a 10% raise to the lowest paid staff in the fictional mountain bike factory:

-- The following query is based on a previous version of AdventureWorks

USE AdventureWorks

-- T-SQL UPDATE statement with TOP filtering

-- SQL INNER JOIN with SELECT subquery (subselect)

UPDATE a

SET    BaseRate = 1.1 * BaseRate

FROM   HumanResources.Employee a

  INNER JOIN 

       (SELECT   TOP ( 10 ) PERCENT WITH TIES EmployeeID

        FROM     HumanResources.Employee

        ORDER BY BaseRate DESC) b

     ON   a.EmployeeID = b.EmployeeID

 

Exam Prep 70-461
Exam 70-461
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE