本文介绍了“COLLATE SQL_Latin1_General_CP1_CI_AS”做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQL查询在SQLServer中创建数据库,如下所示:

I have an SQL query to create the database in SQLServer as given below:

create database yourdb
on
( name = 'yourdb_dat',
  filename = 'c:\program files\microsoft sql server\mssql.1\mssql\data\yourdbdat.mdf',
  size = 25mb,
  maxsize = 1500mb,
  filegrowth = 10mb )
log on
( name = 'yourdb_log',
  filename = 'c:\program files\microsoft sql server\mssql.1\mssql\data\yourdblog.ldf',
  size = 7mb,
  maxsize = 375mb,
  filegrowth = 10mb )
COLLATE SQL_Latin1_General_CP1_CI_AS;
go

运行正常。

虽然SQL的其余部分很清楚我对 COLLATE SQL_Latin1_General_CP1_CI_AS 的功能感到困惑。

While rest of the SQL is clear to be I am quite confused about the functionality of COLLATE SQL_Latin1_General_CP1_CI_AS.

任何人都可以向我解释这个问题吗?此外,我想知道以这种方式创建数据库是否是最佳实践?

Can anyone explain this to me? Also, I would like to know if creating the database in this way is a best practice?

推荐答案

排序。在这种情况下:

SQL_Latin1_General_CP1_CI_AS

分成有趣的部分:


  1. latin1 让服务器使用charset latin 1处理字符串,基本上是ascii

  2. CI 不区分大小写的比较,所以'ABC'将等于'abc' / li>
  3. AS 区分音符,因此'ü'不等于'u'

  1. latin1 makes the server treat strings using charset latin 1, basically ascii
  2. CI case insensitive comparisons so 'ABC' would equal 'abc'
  3. AS accent sensitive, so 'ü' does not equal 'u'

这篇关于“COLLATE SQL_Latin1_General_CP1_CI_AS”做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 02:20