Hey Guys...
There was a small logical check missed in my automated blog(KuwaitFresh.com). And because of this there occured duplicate records which means duplicate posts! which will be not be accepted by any user :) Here is the query to delete duplicate records in your table...
If you would like to list duplicate rows with the count for a table, the following query would be helpful.
Query:Duplicate Rows
SELECT Column1,Column2,Column3,Count(*) FROM dbo.TableName GROUP BY Column1,Column2,Column3 HAVING ( COUNT(*) > 1 )
And there are scenarios where we need to find the combination of Columns in a table occurred only once. In such case the following query could be used.
Query:Unique combination of columns
SELECT Column1,Column2,Column3,Count(*) FROM dbo.TableName GROUP BY Column1,Column2,Column3 HAVING ( COUNT(*) = 1 )
(SELECT TEMP.Sre, TEMP.Tket, TEMP.RDate, TEMP.SKU, TEMP.Qty, TEMP.Esion, SAM.AverageCost*TEMP.Qty AS Expr2 FROM TEMP INNER JOIN SAM ON (TEMP.SKU = SAM.SKU) AND (TEMP.Store = SAM.Sre) WHERE TEMP.RDate >= '07/13/2009' And TEMP.RDate <= '07/19/2009' ) ORDER BY TEMP.Sre, TEMP.Tket
Here is a sample to use XML string as a input to a Stored procedure. The stored procedure uses SP sp_xml_preparedocument. Which is capable of reading a XML string. It parses the XML and provides a parsed document which could be used like a temporary table in run time.
Following is the SQL query used to delete all records from all tables from Database.
This is useful during development scenarios where you need to get rid of all the dummy records and insert a fresh data.
SQL Query: Appropriate comments are provided to explain its operation
/* The Following set of queries is used to delete all records from all tables from your database */