iam having this problem with duplicate records,
I want a query which will check the table for any duplicate records if there are any duplicates it should print "table has duplicates and quit the query and if there ae no duplicates it should print "no duplicates" and executethe query, i tried to use the below query but iam getting some errors could some one help
SELECT count(*) ,material_code
GROUP BY material_code
HAVING count(*) > 1
IF count(*) > 1
PRINT ' SUCCESS - no duplicate rows'
print ' Failed - duplicate rows found'