title: how to change the collate to all the columns of the database?
body: <p>I would like to change the collation of all the columns of all the tables of my database. In stack overflow, I have found this script: (<a href="https://stackoverflow.com/questions/1878430/update-collation-of-all-fields-in-database-on-the-fly">post</a>)</p>
  
  <pre><code>SELECT 'ALTER TABLE [' + SYSOBJECTS.Name + '] ALTER COLUMN [' + SYSCOLUMNS.Name + '] ' +
  SYSTYPES.name + 
      CASE systypes.NAME
      WHEN 'text' THEN ' '
      ELSE
      '(' + RTRIM(CASE SYSCOLUMNS.length
      WHEN -1 THEN 'MAX'
      ELSE CONVERT(CHAR,SYSCOLUMNS.length)
      END) + ') ' 
      END
  
      + ' ' + ' COLLATE Latin1_General__CI_AI ' + CASE ISNULLABLE WHEN 0 THEN 'NOT NULL' ELSE 'NULL' END
      FROM SYSCOLUMNS , SYSOBJECTS , SYSTYPES
      WHERE SYSCOLUMNS.ID = SYSOBJECTS.ID
      AND SYSOBJECTS.TYPE = 'U'
      AND SYSTYPES.Xtype = SYSCOLUMNS.xtype
      AND SYSCOLUMNS.COLLATION IS NOT NULL
      AND NOT ( sysobjects.NAME LIKE 'sys%' )
      AND NOT ( SYSTYPES.name LIKE 'sys%' )
      GO
  </code></pre>
  
  <p>However, when I see the collation of the columns I see that the collation is the old collation.</p>
  
  <p>The actual collation is AS, so I can have "ANIMAL" and "ÁNIMAL". When I execute the script, I don't get any error. I think that I would get an error because the new collation is AI. So this makes me think that the script does nothing.</p>
  
  <p>How can I change the collation of all the columns of all my tables in the database?</p>
  
  <p>Thanks.</p>