728x90
반응형
SELECT TOP 20 * FROM HumanResources.Employee
DECLARE @top INT
SET @top = 10
SELECT TOP(@top) * FROM HumanResources.Employee
-- set value
DECLARE @top INT
SET @top = 10
SET ROWCOUNT @top
SELECT * FROM HumanResources.Employee
-- set value to return all rows
SET ROWCOUNT 0
-- update example
DECLARE @top INT
SET @top = 10
UPDATE TOP(@top) HumanResources.Employee SET MaritalStatus = 'S' WHERE EmployeeID < 20
-- delete example
DECLARE @top INT
SET @top = 10
DELETE TOP(10) HumanResources.Employee WHERE EmployeeID < 20
-- insert example
DECLARE @top INT
SET @top = 10
INSERT TOP(@top) dbo.contact2
SELECT * FROM dbo.contact
DECLARE @top INT
SET @top = 10
SELECT TOP(@top) * FROM HumanResources.Employee
-- set value
DECLARE @top INT
SET @top = 10
SET ROWCOUNT @top
SELECT * FROM HumanResources.Employee
-- set value to return all rows
SET ROWCOUNT 0
-- update example
DECLARE @top INT
SET @top = 10
UPDATE TOP(@top) HumanResources.Employee SET MaritalStatus = 'S' WHERE EmployeeID < 20
-- delete example
DECLARE @top INT
SET @top = 10
DELETE TOP(10) HumanResources.Employee WHERE EmployeeID < 20
-- insert example
DECLARE @top INT
SET @top = 10
INSERT TOP(@top) dbo.contact2
SELECT * FROM dbo.contact
'DB > MS-SQL' 카테고리의 다른 글
트랜잭션 로그 백업 및 크기 줄이기(축소) (0) | 2008.08.29 |
---|---|
응용 프로그램 성능 최적화를 위한 숨겨진 데이터 찾기 (0) | 2008.07.16 |
임시테이블의 OBJECT_ID 얻기 (0) | 2008.06.10 |
복구 모델(Recovery Model) (0) | 2008.05.14 |
SELECT @@VERSION 의 빌드(BUILD) 번호로 서비스팩 및 보안패치 현황 파악하기. (0) | 2008.03.12 |