[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1234
  • Last Modified:

Collation for Create Table

When creating tables with CREATE TABLE, how do I make sure, that SQL Server 2005 uses the Database defautl collation and not the Servers collation??
Right now, I do not have any collations integrated in my scripts.

Chris

e.g.
      
      
      CREATE TABLE [dbo].[tkey_wdKennungTyp](
            [idKennungTyp] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF__tkey_wdKennungTyp__idKennungTyp]  DEFAULT (newid()),
            [KennungTyp] [varchar](255) NULL,
            [KennungTypID] [int] NULL,
            [KennungTypJaNein] [int] NULL,
            [New] [datetime] NULL CONSTRAINT [DF__tkey_wdKennungTyp__New]  DEFAULT (getdate()),
       CONSTRAINT [PK_tkey_wdKennungTyp] PRIMARY KEY NONCLUSTERED ([idKennungTyp] ASC)
       ) ON [PRIMARY]
0
chriswies
Asked:
chriswies
  • 3
  • 2
1 Solution
 
chriswiesAuthor Commented:
btw: right now, the collation on my development system is
      'SQL_Latin1_General_CP1_CI_AS'
when I just saw the difference in my VM testsytem, it was
      'Latin1_General_CI_AS'

I would have the chance to switch. I would choose  'SQL_Latin1_General_CP1_CI_AS' because the MS Access upsizing wiz choose it a few month ago :-)
Do you have any advise which one is better/more appropiate/higher performance...? --> my users language is german; keep that in mind for your advise.
Chris
0
 
chriswiesAuthor Commented:
there are two questions, now -> more points
0
 
PaultheBrokerCommented:
from BOL 2000 - CREATE TABLES

"Specifies the collation for the column. Collation name can be either a Windows collation name or a SQL collation name. The collation_name is applicable only for columns of the char, varchar, text, nchar, nvarchar, and ntext data types. If not specified, the column is assigned either the collation of the user-defined data type, if the column is of a user-defined data type, or the default collation of the database."

So my understanding is that when you create the database, the collation defaults to that of the server, but then when you create tables under the database, the database collation is used.  So the answer to your first question is "you don't need to - the server collation won't be considered"

Obviously you can define collation at the column level to override the database default.
0
 
chriswiesAuthor Commented:
and what is the difference between
SQL_Latin1_General_CP1_CI_AS
and
Latin1_General_CP1_CI_AS

Any Idea?
Chris
0
 
PaultheBrokerCommented:
CPI1 treats unicode data differently from nonunicode:  Latin1-General, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive for Unicode Data, SQL Server Sort Order 52 on Code Page 1252 for non-Unicode Data

'Latin1_General_CI_AS':  Latin1-General, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive

more info here:
http://msdn2.microsoft.com/en-us/library/aa176551(SQL.80).aspx

Also, if you run

SELECT *
FROM ::fn_helpcollations()

you will see some other options, including a whole set of German_phonebook collations.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now