SQL 2005Êý¾ÝÀàÐÍ˵Ã÷
×Ô¶¯±àºÅ£ºÉè×Ö¶ÎÀàÐÍΪ£ºint £¬È»ºóÁÐÊôÐÔÖÐ £¨ÊDZêʶ£©Ñ¡ÊÇ£¬±êʶÖÖ×ÓÑ¡1¡£
ÓÃvarchar(max)´úÌætext¡£varcharµÄ×î´ó³¤¶ÈΪ8000£¬µ«ÊÇvarchar(max)Ôò¿ÉÒÔ´æ´¢¶à´ï2GµÄÊý¾Ý£¬Òò´ËÆä×÷ÓÃÏ൱ÓÚSQL 2000ÖеÄtext¡£µ«ÊÇ΢Èí¿ÉÄÜ»áºóÐøµÄSQL Server°æ±¾ÖÐÒƳýtextÀàÐÍ£¬´ÓÏÖÔÚ¾ÍÓ¦¸ÃÓÃvarchar(max) À´´úÌætext¡£
ÓÃnvarchar(max)´úÌæntext£¬ÓÃbinary(max)´úÌæimage.
ΪXMLÊý¾ÝÑ¡ÔñxmlÀàÐÍ¡£ÔÚSQL Server 2005ÖУ¬ÎªXMLÊý¾ÝÌí¼ÓÁËÏàÓ¦µÄÊý¾ÝÀàÐÍ£¬Òò´Ë´æ´¢XMLÊý¾ÝµÄÁв»ÐèÒªÓà varchar(max)»ònvarchar(max)£¬¶øÓ¦µ±ÓÃxmlÊý¾ÝÀàÐÍ£¬ÒÔÀûÓÃT-SQLÖÐרÃÅÕë¶ÔxmlÊý¾ÝÁеÄÐÂÃüÁÒÔ¼°Õë¶ÔxmlÁеÄË÷Òý¡£
Ò×»ìÏýµÄÊý¾ÝÀàÐÍ
(1)char¡¢varchar¡¢textºÍnchar¡¢nvarchar¡¢ntext
charºÍvarcharµÄ³¤¶È¶¼ÔÚ1µ½8000Ö®¼ä£¬ËüÃǵÄÇø±ðÔÚÓÚcharÊǶ¨³¤×Ö·ûÊý¾Ý£¬¶øvarcharÊDZ䳤×Ö·ûÊý¾Ý¡£Ëùν¶¨³¤¾ÍÊdz¤¶È¹Ì¶¨µÄ£¬µ±ÊäÈëµÄÊý¾Ý³¤¶ÈûÓдﵽָ¶¨µÄ³¤¶Èʱ½«×Ô¶¯ÒÔÓ¢ÎÄ¿Õ¸ñÔÚÆäºóÃæÌî³ä£¬Ê¹³¤¶È´ïµ½ÏàÓ¦µÄ³¤¶È£»¶ø±ä³¤×Ö·ûÊý¾ÝÔò²»»áÒÔ¿Õ¸ñÌî³ä¡£ text´æ´¢¿É±ä³¤¶ÈµÄ·ÇUnicodeÊý¾Ý£¬×î´ó³¤¶ÈΪ2^31-1(2,147,483,647)¸ö×Ö·û¡£
ºóÃæÈýÖÖÊý¾ÝÀàÐͺÍÇ°ÃæµÄÏà±È£¬´ÓÃû³ÆÉÏ¿´Ö»ÊǶàÁ˸ö×Öĸ"n"£¬Ëü±íʾ´æ´¢µÄÊÇUnicodeÊý¾ÝÀàÐ͵Ä×Ö·û¡£Ð´¹ý³ÌÐòµÄÅóÓѶÔUnicodeÓ¦¸ÃºÜÁ˽⡣×Ö·ûÖУ¬Ó¢ÎÄ×Ö·ûÖ»ÐèÒªÒ»¸ö×Ö½Ú´æ´¢¾Í×ã¹»ÁË£¬µ«ºº×ÖÖڶ࣬ÐèÒªÁ½¸ö×Ö½Ú´æ´¢£¬Ó¢ÎÄÓ뺺×Öͬʱ´æÔÚʱÈÝÒ×Ôì³É»ìÂÒ£¬Unicode×Ö·û¼¯¾ÍÊÇΪÁ˽â¾ö×Ö·û¼¯ÕâÖÖ²»¼æÈݵÄÎÊÌâ¶ø²úÉúµÄ£¬ËüËùÓеÄ×Ö·û¶¼ÓÃÁ½¸ö×Ö½Ú±íʾ£¬¼´Ó¢ÎÄ×Ö·ûÒ²ÊÇÓÃÁ½¸ö×Ö½Ú±íʾ¡£nchar¡¢nvarcharµÄ³¤¶ÈÊÇÔÚ1µ½4000Ö®¼ä¡£ºÍchar¡¢varchar±È½Ï£ºnchar¡¢nvarcharÔò×î¶à´æ´¢4000¸ö×Ö·û£¬²»ÂÛÊÇÓ¢ÎÄ»¹ÊǺº×Ö£»¶øchar¡¢varchar×î¶àÄÜ´æ´¢8000¸öÓ¢ÎÄ£¬4000¸öºº×Ö¡£¿ÉÒÔ¿´³öʹÓÃnchar¡¢nvarcharÊý¾ÝÀàÐÍʱ²»Óõ£ÐÄÊäÈëµÄ×Ö·ûÊÇÓ¢ÎÄ»¹ÊǺº×Ö£¬½ÏΪ·½±ã£¬µ«ÔÚ´æ´¢Ó¢ÎÄʱÊýÁ¿ÉÏÓÐЩËðʧ¡£
(2)datetimeºÍsmalldatetime
datetime£º´Ó1753Äê1ÔÂ1ÈÕµ½9999Äê12ÔÂ31ÈÕµÄÈÕÆÚºÍʱ¼äÊý¾Ý£¬¾«È·µ½°Ù·ÖÖ®ÈýÃë¡£
smalldatetime£º´Ó1900Äê1ÔÂ1ÈÕµ½2079Äê6ÔÂ6ÈÕµÄÈÕÆÚºÍʱ¼äÊý¾Ý£¬¾«È·µ½·ÖÖÓ¡£
(3)bitint¡¢int¡¢smallint¡¢tinyintºÍbit
bigint£º´Ó-2^63(-9223372036854775808)µ½2^63-1(9223372036854775807)µÄÕûÐÍÊý¾Ý¡£
int£º´Ó-2^31(-2,147,483,648)µ½2^31-1(2,147,483,647)µÄÕûÐÍÊý¾Ý¡£
smallint£º´Ó-2^15(-32,768)µ½2^15-1(32,767)µÄÕûÊýÊý¾Ý¡£
tinyint£º´
Ïà¹ØÎĵµ£º
×î½üÔÚѧϰHibernate£¬Êý¾Ý¿âÊÇSQL 2000£¬myEclipse7.5£¬¸ù¾ÝÀý×ÓÅäÖúÃHibernateÖ®ºóÔËÐУ¬³öÏÖ£º
com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys() Õâ¸ö´íÎ󣬵¹ÌÚ°ëÌìÖ®ºó·¢ÏÖÊÇmsbase.jar¡¢mssqlserver.jar¡¢msutil.jarÕâÈý¸ö°üµÄÎÊÌ⣬SQL 2000µÄÊý¾Ý¿âÇý¶¯ÐèÒª×îеİ汾£¬ÕâÈý¸ö°ü¸ ......
CHARINDEXº¯Êý·µ»Ø×Ö·û»òÕß×Ö·û´®ÔÚÁíÒ»¸ö×Ö·û´®ÖеÄÆðʼλÖá£CHARINDEXº¯Êýµ÷Ó÷½·¨ÈçÏ£º
CHARINDEX ( expression1 , expression2 [ , start_location ] )
Expression1ÊÇÒªµ½expression2ÖÐÑ°ÕÒµÄ×Ö·ûÖУ¬start_locationÊÇCHAR ......
ÏÖÓÐtable_for_report_1ºÍtable_for_report_2£¬ÏêÇéÈçÏ£º
table_for_report_1ÓÐnum×ֶΣ¬c1,c2,c3×ֶΡ£
Êý¾ÝÈçÏ£º
num c1 c2 c3
1 15001346690 11 12 13
2 1 ......
Ê×ÏÈ£º·ÖÀëÊý¾Ý¿â
ÆóÒµ¹ÜÀíÆ÷--ÓÒ¼üsuspectµÄÊý¾Ý¿â--ËùÓÐÈÎÎñ--·ÖÀëÊý¾Ý¿âÈ»ºó±¸·ÝÄãµÄsuspectÊý¾Ý¿âµÄÎļþ,ÔÙ°´ÏÂÃæµÄ²½Öè´¦Àí:
1.н¨Ò»¸öͬÃûµÄÊý¾Ý¿â
2.ÔÙÍ£µôsql server
3.ÓÃsuspectÊý¾Ý¿âµÄÎļþ¸²¸ÇµôÕâ¸öн¨µÄͬÃûÊý¾Ý¿â
4.ÔÙÖØÆôsql server
5.´Ëʱ´ò¿ªÆóÒµ¹ÜÀíÆ÷ʱн¨µÄͬÃûÊý¾Ý¿â»á³öÏÖÖÃÒÉ£¬ÏȲ»¹Ü£¬Ö´ ......
ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
select * from v$version;
²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES ......