Thursday, August 27, 2009

How to delete duplicate records in sql database

It took me deleting ALL the records from my database before I figured out how to do this! :( My solution to the problem of duplicate records in the database relies on the fact that there is at least ONE column that has duplicate information. In my case I only had two records where there should have been one. So the code I used to remove one of the two duplicated records is as follows:

DELETE A
FROM [emailsTable] A, [emailTable] B
WHERE A.MessageID = B.MessageID
AND A.GUID > B.GUID

Friday, August 14, 2009

IMAP is the devil

I spent the morning trying to figure out how to use IMAP. I want to write my own little asp.net function that just marks all e-mails in an inbox as read and couldn't believe how difficult it was to find this information. I finally stumbled upon bobpeers.com who's site had many GREAT examples of how to execute IMAP command via telnet. With the help of this example and the IMAP4rev1 paper I was able to accomplish what I needed.

<bobpeers.com /> posting

IMAP4rev1 paper