/**
* MS SQL Paging Query - MS SQL üzerinde sayfalama böyle yapılıyor
*
*/
WITH ApplicationEntity As
(
SELECT ROW_NUMBER() OVER (ORDER BY ID) AS Row,*
FROM APPLICATIONS
)
SELECT *
FROM ApplicationEntity AE
WHERE AE.Row Between @START AND @START+@ITEM_PER_PAGE
ORDER BY AE.Row ASC
/*« SQL SERVER – T-SQL Script to find the CD key from RegistrySQL SERVER – QUOTED_IDENTIFIER ON/OFF and ANSI_NULL ON/OFF Explanation »
SQL SERVER – Delete Duplicate Records – Rows
March 1, 2007 by pinaldave
Following code is useful to delete duplicate records. The table must have identity column, which will be used to identify the duplicate records. Table in example is has ID as Identity Column and Columns which have duplicate data are DuplicateColumn1, DuplicateColumn2 and DuplicateColumn3.
http://blog.sqlauthority.com/2007/03/01/sql-server-delete-duplicate-records-rows/
*/
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)