title: How can I exclude GUIDs from a select distinct without listing all other columns in a table?
body: <p>So let's say 'table' has two columns that act as a GUID - the ID column and msrepl_tran_version.  Our original programmer did not know that our replication created this column and included it in a comparison, which has resulted in almost 20,000 records being put into this table, of which only 1,588 are ACTUALLY unique, and it's causing long load times.</p>
  
  <p>I'm looking for a way to exclude the ID and replication columns from a select distinct, without having to then list every single column in the table, since I'm going to have to select from the record set multiple times to fix this (there are other tables affected and the query is going to be ridiculous) I don't want to have to deal with my code being messy if I can help it.</p>
  
  <p>Is there a way to accomplish this without listing all of the other columns?</p>
  
  <pre><code>Select distinct {* except ID, msrepl_tran_version} from table
  </code></pre>
  
  <p>Other than (where COL_1 is ID and COL_N is the replication GUID)</p>
  
  <pre><code>Select distinct COL_2, ..., COL_N-1, COL_N+1, ... from table
  </code></pre>