From the PRINT Output of the below statement if you parse the statements
declare @sql VARCHAR(MAX)
SELECT @SQL = COALESCE(@sql + CHAR(13) + 'use [master] ','use [master] ' + CHAR(13)) + 'ALTER DATABASE ' + quotename(name) + ' COLLATE SQL_Latin1_General_CP1_CS_AS ' + CHAR(13) + 'GO' from sys.databases where name not in ('master','tempdb','model','msdb','ReportServer','ReportServerTempDB','distribution') ORDER BY name PRINT @SQL
It would throw error, but I replace CHAR(13) with CHAR(10) OR CHAR(10) + CHAR(13) (thanks to one of colleague) the same statements just works fine.
How is line feed different from carriage line feed and what is the standard one should follow for such dynamic SQL Generation.
Thanks,
Varun