I know that it is not possible to set a collation for a session in sql server.
I have different servers with different collations, however, one of them is a case sensitive collation and that can be more tough on the details as you can see on the picture below.
Is there any setting or anything I can do to develop my scripts as if the collation was a case sensitive one, so that when I need to port scripts to a case sensitive server all would be already fine?
I have been looking for manipulating the collation without changing anything, trying to limit it to my session so to say, but I could not find anything, is there anything I could do?
set transaction isolation level read uncommitted
set nocount on
set deadlock_priority low
use ReportServer
--select * from sys.tables
select top 10 Name, Path, CreationDate
from dbo.catalog
order by path COLLATE Latin1_General_100_CI_AS_KS_WS desc
exec sp_help 'dbo.catalog'
DECLARE @SQL nvarchar(max)
SET @SQL='use ReportServer;select top 10 Name,
Path, CreationDate from dbo.Catalog order by path '
SET @SQL=@SQL + 'COLLATE Latin1_General_BIN DESC'
PRINT @SQL
EXEC sp_executesql @SQL
SET @SQL='use ReportServer;select top 10 Name, Path,
CreationDate from dbo.Catalog order by path '
SET @SQL=@SQL + 'COLLATE SQL_Latin1_General_CP1250_CS_AS DESC'
PRINT @SQL
EXEC sp_executesql @SQL
use master
go
SELECT name, COLLATIONPROPERTY(name, 'CodePage') AS Code_Page, description
FROM sys.fn_helpcollations()
ORDER BY name;