sql×Ö¶ÎÀàÐÍ
(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)¡£
Êý¾Ý¿â¶¨Òåµ½charÀàÐ͵Ä×Ö¶Îʱ£¬²»ÖªµÀ´ó¼ÒÊÇ·ñ»áÓÌԥһϣ¬µ½µ×Ñ¡char¡¢nchar¡¢varchar¡¢nvarchar¡¢text¡¢ntextÖ
Ïà¹ØÎĵµ£º
drop table #t
create table #t(req_spid int,obj_name sysname)
declare @s nvarchar(4000)
,@rid int,@dbname sysname,@id int,@objname sysnam ......
Èç¹ûtemp_t1²»´æÔÚ£¬
oracle:
create table temp_t1
as
select * from t1
sql server:
select * into temp_t1 from t1
Èç¹ûtemp_t1´æÔÚ£¬
oracle:
insert into table temp_t1
select * from t1
sql server:
insert into table temp_t1
select * from t1 ......
Ñ¡Ôñ10gÊÇÒòΪ¶ÔÍø¸ñ¼¼Êõ±È½ÏºÃÆ棬ºÃÏñ»¹Ã»µÃµ½¹ã·ºÓ¦Óã¬Ò²¾ÍÎÞËùνÓëÇ°Ãæ°æ±¾ÓкܴóÇø±ðÁË¡£
ÔÚѸÀ×ÉÏÏÂÁ˸öÈí¼þ£¬ÔËÐÐsqlplusw£¬È»ºóÕÕ×ÅÊ飬¿ñÇÃÁËÒ»·£¬ÓÐÔÚÍøÉÏÏÂÁ˸öÊÓƵ½Ì³Ì£¨MLDNħÀֿƼ¼_Oracle¿ÎÌã©£¬½²µÃͦºÃµÄ£¬¾ÍÊÇʱ¼ä³¤Á˵㣬²»Èç¿´ÊéÀ´µÃ¿ì¡£·´ÕýÏÖÔÚÖ»ÊÇÏëÊìϤһÏ»ù±¾Óï¾ä¡£
¿´ÁËÁ½ÌìÊéÁË¡£Á˽âÁËÒ» ......
´ÓÕâÒ»½Ú¿ªÊ¼ÄØ£¬ÎÒÃǾÍÒª¿ªÊ¼CLRµÄ±à³ÌÖ®ÂÃÁË¡£ÔÚÕâ֮ǰ£¬ÎÒÏȰѱ¾½ÚÖÐÐèÒªÁ˽âµÄÁ½¸öÐÂÀàSqlDataRecordºÍSqlMetaData£¬¼°Îå¸öз½·¨SqlContext.Pipe.SendResultsStart£¬SqlContext.Pipe.SendResultsRow£¬SqlContext.Pipe.SendResultsEnd£¬SqlContext.Pipe.SendºÍSqlContext.Pipe.ExecuteAndSend½øÐÐһϱØÒªµÄ˵Ã÷£¬·½±ã´ ......
Ò»¡¢Ê²Ã´ÊÇSQL×¢Èëʽ¹¥»÷£¿
ËùνSQL×¢Èëʽ¹¥»÷£¬¾ÍÊǹ¥»÷Õß°ÑSQLÃüÁî²åÈëµ½Web±íµ¥µÄÊäÈëÓò»òÒ³ÃæÇëÇóµÄ²éѯ×Ö·û´®£¬ÆÛÆ·þÎñÆ÷Ö´ÐжñÒâµÄSQLÃüÁî¡£ÔÚijЩ±íµ¥ÖУ¬Óû§ÊäÈëµÄÄÚÈÝÖ±½ÓÓÃÀ´¹¹Ô죨»òÕßÓ°Ï죩¶¯Ì¬SQLÃüÁ»ò×÷Ϊ´æ´¢¹ý³ÌµÄÊäÈë²ÎÊý£¬ÕâÀà±íµ¥ÌرðÈÝÒ×Êܵ½SQL×¢Èëʽ¹¥»÷¡£³£¼ûµÄSQL×¢Èëʽ¹¥»÷¹ý³ÌÀàÈ磺
¢Å ......