Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Collation for Create Table

Posted on 2007-11-30
5
1,155 Views
Last Modified: 2010-05-18
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
Comment
Question by:chriswies
  • 3
  • 2
5 Comments
 

Author Comment

by:chriswies
ID: 20381707
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
 

Author Comment

by:chriswies
ID: 20381712
there are two questions, now -> more points
0
 
LVL 6

Expert Comment

by:PaultheBroker
ID: 20381976
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
 

Author Comment

by:chriswies
ID: 20382036
and what is the difference between
SQL_Latin1_General_CP1_CI_AS
and
Latin1_General_CP1_CI_AS

Any Idea?
Chris
0
 
LVL 6

Accepted Solution

by:
PaultheBroker earned 500 total points
ID: 20382066
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question