Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

½²½âSQL ServerÖÐÈÝÒ×»ìÏýµÄÊý¾ÝÀàÐÍ


½²½âSQL ServerÖÐÈÝÒ×»ìÏýµÄÊý¾ÝÀàÐÍ
(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£º´Ó0µ½255µÄÕûÊýÊý¾Ý¡£
¡¡¡¡bit£º1»ò0µÄÕûÊýÊý¾Ý¡£
¡¡¡¡(4)decimalºÍnumeric
¡¡¡¡ÕâÁ½ÖÖÊý¾ÝÀàÐÍÊǵÈЧµÄ¡£¶¼ÓÐÁ½¸ö²ÎÊý£ºp(¾«¶È)ºÍs(СÊýλÊý)¡£pÖ¸¶¨Ð¡Êýµã×ó±ßºÍÓұ߿ÉÒÔ´æ´¢µÄÊ®½øÖÆÊý×ÖµÄ×î´ó¸öÊý£¬p±ØÐëÊÇ´Ó 1µ½38Ö®¼äµÄÖµ¡£sÖ¸¶¨Ð¡ÊýµãÓұ߿ÉÒÔ´æ´¢µÄÊ®½øÖÆÊý×ÖµÄ×î´ó¸öÊý£¬s±ØÐëÊÇ´Ó0µ½pÖ®¼äµÄÖµ£¬Ä¬ÈÏСÊýλÊýÊÇ0¡£
¡¡¡¡(5)floatºÍreal
¡¡¡¡float£º´Ó-1.79^308µ½1.79^308Ö®¼äµÄ¸¡µãÊý×ÖÊý¾Ý¡£
¡¡¡¡real£º´Ó-3.40^38µ½3.40^38Ö®¼äµÄ¸¡µãÊý×ÖÊý¾Ý¡£ÔÚSQL ServerÖУ¬realµÄͬÒå´ÊΪfloat(24)¡£


Ïà¹ØÎĵµ£º

SQLÓï¾äPART9

Group functions
SELECT [column,] group_function(column) ... from table [WHERE condition] [GROUP BY group_by_expression] [ORDER BY column];
e.g.:
SELECT department_id, job_id, SUM(salary), COUNT(employee_id) from employees GROUP BY department_id, job_id ;
SELECT [column,] group_function(column).. ......

SQLÓï¾äPART11


1. My test: (create and grant the sysdba to a new user by SQL*Plus)
CREATE USER FJTEST1 IDENTIFIED BY JEANJEANFANG;
GRANT SYSDBA TO FJTEST;
REVOKE SYSDBA from FJTEST;
CONNECT FJTEST1/JEANJEANFANG AS SYSDBA;
2. Using ORAPWD in windows:
C:\» ORAPWD;
(show help information)
3. to see th ......

sql serverÖÐinºÍexistsµÄСÇø±ð oracleδ²âÊÔ

in µÄ»°£¬ Èç¹ûÊÇnull ¾Í²»±È½ÏÁË£¬¼È²»ÊÇin Ò²²»ÊÇ not in
existsµÄ»° ÒòΪÓà = ¼ÓÔÚÌõ¼þÀï±È½ÏÁË£¬ËùÒÔ null ÊÇ not exists
select *
from pricetemp
where cast(ÉÌÆ·¥³ー¥É as varchar(10))not in(
           select shohin_cd
  &nbs ......

sql ÐÞ¸ÄÁÐÃû¼°±íÃû

´úÂëÈçÏ£º
EXEC sp_rename '±íÃû.[Ô­ÁÐÃû]', 'ÐÂÁÐÃû', 'column'
*************************************************************************
Transact-SQL ²Î¿¼
sp_rename
¸ü¸Äµ±Ç°Êý¾Ý¿âÖÐÓû§´´½¨¶ÔÏó£¨Èç±í¡¢ÁлòÓû§¶¨ÒåÊý¾ÝÀàÐÍ£©µÄÃû³Æ¡£
ʾÀý
A. ÖØÃüÃû±í
ÏÂÀý½«±í customers ÖØÃüÃûΪ custs¡£ ......

SQL ServerÖеÄͨÅä·û

ͨÅä·û_
"_"ºÅ±íʾÈÎÒâµ¥¸ö×Ö·û,¸Ã·ûºÅÖ»ÄÜÆ¥ÅäÒ»¸ö×Ö·û."_"¿ÉÒÔ·ÅÔÚ²éѯÌõ¼þµÄÈÎÒâλÖÃ,ÇÒÖ»ÄÜ´ú±íÒ»¸ö×Ö·û.Ò»¸öºº×ÖֻʹÓÃÒ»¸ö"_"±íʾ.
Àý×Ó£º
if PATINDEX('%[ß¹-×ö]%','ÐèÒªÅжϵÄ×Ö·û')>0 -- ÅжÏÊÇ·ñÓÐ×Ö·û
print 'Óкº×Ö'
else
print 'ÎÞºº×Ö'
ͨÅä·û%
"%"·ûºÅÊÇ×Ö·ûÆ¥Åä·û,ÄÜÆ¥Åä0¸ö»ò¸ü¶à×Ö·ûµÄÈÎÒⳤ¶ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ