SQL ServerµÄ¶¨Ðò(Collation)
ʹÓÃSQL ServerµÄÅóÓÑ們應該¶¼ÖªµÀSQL ServerµÄ資ÁÏ庫ÓÐÒ»個設¶¨½Ð×ö¶¨Ðò(Collation)£¬½ñÌìÎÒ們¾Í來¿´¿´¶¨Ðò這東Î÷ÊÇʲ麼£¬Ê×ÏÈÎÒ們¿´Ò»ÏÂWikiÉÏ對¶¨ÐòµÄ說Ã÷£º
Collation is the assembly of written information into a standard order. One common type of collation is called alphabetisation, though collation is not limited to ordering letters of the alphabet. Collating lists of words or names into alphabetical order is the basis of most office filing systems, library catalogs and reference books..[Reference from here.]
這¶Î話講µÃÐþÁË點£¬ÎÒ們¿´ÁíÒ»個±È較Ò׶®µÄ說Ã÷£º
Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.[Reference from here.]
這¶Î話¾Í簡潔¶àÁË£¬簡單來說¶¨ÐòÖ¸µÄ¾ÍÊÇ決¶¨資Áϱ»ÅÅÐò與±È對µÄ規則£¬¶ø±È對µÄ規則Ò»°ã¿É´Ö·Ö為幾´ó類£º
¶¨ÐòµÄ·Ö類
Case sensitivity(CS)
簡單來說¾ÍÊÇ區·Ö´óС寫£¬A¸úaÊDz»Í¬µÄ£¬Èç¹ûÊÇCase Insensitive(CI)µÄ話AÔÚÅÅÐò»òÕß²é詢時¾Í會±»視為Ïàͬ£¬Ò²¾ÍÊDzé詢A£¬連ͬaÒ²會±»²é詢µ½¡£
Accent sensitivity(AS)
´ú±íµÄÊÇÇ»調ÉϵIJî別£¬a¸úá¡¢o¸úóÔÚÇ»調ÉÏÊÇÏàͬµÄ£¬ÄDzé詢時ÊÇÒª視為Ïàͬ£¬Èç¹ûÊǵÄ話£¬ÄǾÍÊÇAccent Insensitive(AI)£¬Èç¹û²»ÊǵÄ話¾Í視為Accent sensitive¡£
Kana Sensitivity(KS)
ÈÕÎÄÖеÄƬ¼ÙÃû(Hiragana)與ƽ¼ÙÃû(Katakana)Èç¹û±»視為Ïàͬ£¬ÄǾÍÊÇKana Insensitive(KI)£¬·´Ö®¾ÍÊÇKane sensitive.¡£
Width sensitivity(WS)
當°ëÐÎ×Ö與È«ÐÍ×Ô±»視為Ïàͬ(A¸ú£Á)£¬ÄǾÍÊÇWidth Insensitive(
Ïà¹ØÎĵµ£º
ʹÓÃÁËÒ»¶Îʱ¼äºó£¬SQL Server µÄ LDFÎļþÌå»ý¾Þ´ó.
ÈçºÎ´¦ÀíàÏ, ¶ÔÓÚ SQL Server 2005 ¼°Ö®Ç°µÄ°æ±¾£¬¿ÉÒÔʹÓÃÈçÏ SQL£º
declare @name varchar(50)
set @name='dbname
'
backup
log @name
with truncate_only
dbcc shrinkdatabase (@name,20)
¿ÉÊÇÔÚ SQL Server 2008 ¿ªÊ¼£¬Ö´ÐÐÉÏÃæµÄÓï¾ä»á±¨´í:
'truncate ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØϵÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾÌáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõļ¸¸ö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃ ......
´íÎóÌáʾ£º
Ö¸¶¨µÄÁ¬½ÓÀàÐÍ“OLEDB”δ±»Ê¶±ðΪÓÐЧµÄÁ¬½Ó¹ÜÀíÆ÷ÀàÐÍ¡£µ±ÊÔͼ´´½¨Î´ÖªÁ¬½ÓÀàÐ͵ÄÁ¬½Ó¹ÜÀíÆ÷ʱ»á·µ»Ø´Ë´íÎó¡£Çë¼ì²éÁ¬½ÓÀàÐÍÃû³ÆµÄƴдÊÇ·ñÕýÈ·¡£
½â¾ö·½·¨£º
sqlserver2005-ÅäÖù¤¾ß-SqlServer configuration manager-SqlServer2005·þÎñ-sqlserver Integration Services£¬ÓÒ»÷-Ñ¡ÔñÊôÐÔ£¬È»ºó° ......
Òª´´½¨Á½¸öÎļþ
1: runBatch.bat
2: sql.txt
runBatch.bat ÄÚÈÝÈçÏ£º
sqlplus username/password @sql.txt
pause
sql.txtÄÚÈÝÈçÏ£º
spool sql.log
create table t1(cname char(20));
insert into t1(cname) values('test');
select * from t1;
spool off
exit
Ë«»÷runBatch.bat¾Í¿ÉÒÔÅúÁ¿Ö´ÐÐsql.txtÖÐ ......