IF NOT EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[HCOVID]') AND name = N'IX_HCOVID_HTCKIMLIKNO')
BEGIN

	DELETE FROM HCOVID WHERE HCOVIDID IN (SELECT MAX(HCOVIDID) FROM HCOVID GROUP BY HTCKIMLIKNO HAVING COUNT(HCOVIDID)>1) 
	DELETE FROM HCOVID WHERE HCOVIDID IN (SELECT MAX(HCOVIDID) FROM HCOVID GROUP BY HTCKIMLIKNO HAVING COUNT(HCOVIDID)>1) 
	DELETE FROM HCOVID WHERE HCOVIDID IN (SELECT MAX(HCOVIDID) FROM HCOVID GROUP BY HTCKIMLIKNO HAVING COUNT(HCOVIDID)>1) 
	DELETE FROM HCOVID WHERE HCOVIDID IN (SELECT MAX(HCOVIDID) FROM HCOVID GROUP BY HTCKIMLIKNO HAVING COUNT(HCOVIDID)>1) 

	CREATE UNIQUE NONCLUSTERED INDEX [IX_HCOVID_HTCKIMLIKNO] ON [dbo].[HCOVID]
	(	
		[HTCKIMLIKNO] ASC
	)
	WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

END
go