Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Collation for Create Table

Posted on 2007-11-30
5
Medium Priority
?
1,219 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
[X]
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
  • 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 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