SQL Server: Build Versions and Collation basics
SQL Server Build Version
How to
determine which version I am running?
Changing the
compatibility
How to Change the Collation
Collations
specify the rules for how strings of character data are sorted and compared,
based on the norms of particular languages and locales.
/* Find Collation of SQL Server Database */
SELECT
DATABASEPROPERTYEX
(
'AdventureWorks'
,
'Collation'
)
GO
/* Find Collation of SQL Server Database Table Column */
USE
AdventureWorks
GO
SELECT
name
,
collation_name
FROM
sys.columns
WHERE
OBJECT_ID
IN
(
SELECT
OBJECT_ID
FROM
sys.objects
WHERE
type
=
'U'
AND
name
=
'Address'
)
AND
name
=
'City'
- Changing the server collation is difficult. It will take to follow some procedures. Below link is the reference
- Change a particular column is easy as comparison
More precisely described inUSE
AdventureWorks
GO
/* Create Test Table */
CREATE TABLE
TestTable
(
FirstCol
VARCHAR
(
10
))
GO
/* Check Database Column Collation */
SELECT
name
,
collation_name
FROM
sys.columns
WHERE
OBJECT_ID
IN
(
SELECT
OBJECT_ID
FROM
sys.objects
WHERE
type
=
'U'
AND
name
=
'TestTable'
)
GO
/* Change the database collation */
ALTER TABLE
TestTable
ALTER COLUMN
FirstCol
VARCHAR
(
10
)
COLLATE SQL_Latin1_General_CP1_CS_AS
NULL
GO
/* Check Database Column Collation */
SELECT
name
,
collation_name
FROM
sys.columns
WHERE
OBJECT_ID
IN
(
SELECT
OBJECT_ID
FROM
sys.objects
WHERE
type
=
'U'
AND
name
=
'TestTable'
)
GO
/* Database Cleanup */
DROP TABLE
TestTable
GO
http://www.codeproject.com/Articles/302405/The-Easy-way-of-changing-Collation-of-all-Database
Comments
Post a Comment