sqlÖÐvarcharºÍnumericÓ÷¨
varcharÓÃÓÚ´æ´¢¿É±ä³¤¶È×Ö·û´®£¨1-8000×Ö·û£©£¬numericÓÃÓڴ洢׼ȷ¶¨Ãü£¨Ö¸¶¨³¤¶ÈºÍ¾«¶È£©£¬Á½ÕßÇø±ðÔÚÓÚ³¤¶È¡¢Êý¾ÝÀàÐÍ¡¢¾«¶ÈºÍ´æ´¢¿Õ¼ä¡£varcharµÄ³¤¶È¿É±ä£¬numericµÄ³¤¶ÈÀο¿£»varchar´æ´¢×Ö·û´®£¬numeric´æ´¢Êý×Ö£»numeric¾«¶È¸ü¸ß£»varchar½ö´æ´¢ÐëÒª³¤¶È£¬numericʼÖÕÕ¼ÓÃÖ¸¶¨³¤¶È¡£
VARCHAR ºÍ NUMERIC ÔÚ SQL ÖеÄÓ÷¨
VARCHAR
VARCHAR Êǿɱ䳤¶ÈÊý¾ÝÀàÐÍ£¬ÓÃÓÚ´æ´¢³¤¶È¿É±äµÄ×Ö·û´®Êý¾Ý¡£Æ䳤¶È¿ÉÒÔÔÚ½ç˵Êý¾ÝÀàÐÍʱָ¶¨£¬¹æģΪ 1 µ½ 8,000 ¸ö×Ö·û¡£VARCHAR ͨ³£ÓÃÓÚ´æ´¢Îı¾¡¢µØµã»òÈκÎÆäËû¿ÉÄÜÐèÒª²î±ð³¤¶ÈµÄÊý¾Ý¡£
NUMERIC
NUMERIC ÊÇÀο¿³¤¶ÈÊý¾ÝÀàÐÍ£¬ÓÃÓڴ洢׼ȷ¶¨Ãü¡£Æ䳤¶ÈºÍ¾«¶È¿ÉÒÔÔÚ½ç˵Êý¾ÝÀàÐÍʱָ¶¨¡£³¤¶ÈÊÇÖ¸Êý×Ö²¿·ÖµÄ×ÜλÊý£¬¶ø¾«¶ÈÊÇָСÊýµãºóµÄλÊý¡£NUMERIC ͨ³£ÓÃÓڴ洢Ǯ±ÒÖµ¡¢ÕÉÁ¿Öµ»òÈκÎÆäËûÐèҪ׼ȷÊý×ÖÌåÏÖµÄÊý¾Ý¡£
VARCHAR ºÍ NUMERIC µÄÇø±ð
³¤¶È£ºVARCHAR µÄ³¤¶È¿É±ä£¬¶ø NUMERIC µÄ³¤¶ÈÀο¿¡£
Êý¾ÝÀàÐÍ£ºVARCHAR ´æ´¢×Ö·û´®Êý¾Ý£¬¶ø NUMERIC ´æ´¢Êý×ÖÊý¾Ý¡£
¾«¶È£ºNUMERIC Ìṩ¸ü¸ßµÄ¾«¶È£¬¶ø VARCHAR ÔòûÓо«¶È¡£
´æ´¢¿Õ¼ä£ºVARCHAR ½ö´æ´¢ÐëÒª³¤¶ÈµÄÊý¾Ý£¬¶ø NUMERIC ʼÖÕÕ¼ÓÃÆäÖ¸¶¨µÄ³¤¶È¡£
ÓÃÀý
VARCHAR£º
´æ´¢Óû§ÐÕÃû
´æ´¢µØµã
´æ´¢²úÆ·ÐÎò
NUMERIC£º
´æ´¢Ç®±Ò½ð¶î
´æ´¢¾àÀëÕÉÁ¿
´æ´¢¿ÆѧÅÌËãЧ¹û
×¢ÖØÊÂÏî
VARCHAR ´æ´¢×Ö·û´®Êý¾Ý£¬Òò´ËÎÞ·¨¾ÙÐÐÊýѧÔËËã¡£
NUMERIC ´æ´¢×¼È·¶¨Ãü£¬Òò´Ë²»ÊÊÓÃÓÚ½üËÆÅÌËã¡£
ÔÚÑ¡ÔñÊý¾ÝÀàÐÍʱ£¬Çë×Ðϸ˼Á¿Êý¾ÝµÄ¾Þϸ¡¢¾«¶ÈºÍÓ÷¨¡£
ÒÔÉϾÍÊÇsqlÖÐvarcharºÍnumericÓ÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡