Never, never forget to add the COLLATION of your temporary tables when you write MS-SQL server stored procedures. If you forget to do that and you ever migrate from say SQL Server 2005 to SQL Server 2000 some database, you end up doing the following:

  • naively reimport everything
  • try to compile the SP just to receive some weird errors message about the existing COLLATION if you ever have a conflict between your COLLATIONS
  • later, try to run the SP and get some nice runtime errors because tempdb uses a different COLLATION than the one in your database
  • lose one complete afternoon scripting stuff like ALTER TABLE ALTER COLUMN foo varchar(3) COLLATE ....
  • hope this si something that is never going to happen again.