Delete Duplicate Rows SQL Server

1. Add an Identity Column to the Table alter table MASTER add identity_col int identity(1,1); 2. Delete duplicate data using Below Query (In the GROUP BY CLAUSE you can specify multiple columns if the row is indetified using more than one field) delete from MASTER where identity_col not in ( select Min(identity_col) from MASTER group … Continue reading Delete Duplicate Rows SQL Server

Advertisements

Stored Procedure to Insert Data SQL Server

CREATE TABLE [dbo].[MASTER]( [BANK_CODE] [varchar](30) NULL, [TRNX_UID] [float] NULL, [CARD_TYPE] [varchar](30) NULL, [DIR_FLAG] [varchar](30) NULL, [ACQ_CODE] [varchar](30) NULL, [ACQ_DESC] [varchar](200) NULL, [ISS_CODE] [varchar](30) NULL, [ISS_DESC] [varchar](200) NULL, [TRNX_STATUS] [varchar](30) NULL, [TRNX_TYPE] [varchar](30) NULL, [TERMINAL_ID] [varchar](200) NULL, [CARD_NO] [varchar](100) NULL, [CURRENCY_CODE] [varchar](30) NULL, [AMOUNT_FC] [numeric](20, 6) NULL, [AMOUNT_LC] [numeric](20, 2) NULL, [CURRENCY_RATE] [numeric](10, 6) NULL, [TRNX_DATE] … Continue reading Stored Procedure to Insert Data SQL Server