Narrative:

On an IFR flight from ZZZ1 to ZZZ2 at FL190; the engine began to run rough after approximately 1.5 hours of flight. Shortly before that event; I had switched from the left tank to the right. I was located approximately 20 miles from ZZZ airport. I started the low boost fuel pump; canceled IFR and began a slow descent to ZZZ airport. I was asked by center if I wanted to declare an emergency. I said yes. In my anxiety over the rough engine; I forgot to return to the left fuel tank. After landing at ZZZ; I discovered that there was water in the right fuel tank; as evidenced by some residual water in the sump drain cup. After warming the plane in the hangar; I checked the fuel sump and continued my flight VFR.

Google
 

Original NASA ASRS Text

Title: A M20K pilot experienced a rough running engine on a cross country flight. He declared an emergency and diverted to the nearest airport; where he found water in the right fuel tank.

Narrative: On an IFR flight from ZZZ1 to ZZZ2 at FL190; the engine began to run rough after approximately 1.5 hours of flight. Shortly before that event; I had switched from the left tank to the right. I was located approximately 20 miles from ZZZ Airport. I started the low boost fuel pump; canceled IFR and began a slow descent to ZZZ Airport. I was asked by Center if I wanted to declare an emergency. I said yes. In my anxiety over the rough engine; I forgot to return to the left fuel tank. After landing at ZZZ; I discovered that there was water in the right fuel tank; as evidenced by some residual water in the sump drain cup. After warming the plane in the hangar; I checked the fuel sump and continued my flight VFR.

Data retrieved from NASA's ASRS site as of April 2012 and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.