sqlÖÐСÊýÔõôÌåÏÖ
ÔÚ sql ÖУ¬Ð¡Êýͨ³£Ê¹Óà decimal »ò numeric Êý¾ÝÀàÐÍÌåÏÖ¡£decimal ÓÃÓÚÌåÏÖÀο¿¾«¶ÈºÍСÊýλÊýµÄСÊý£¬¶ø numeric ÔÊÔÊÐí±ä¾«¶ÈºÍСÊýλÊý¡£Ñ¡ÔñºÏÊʵÄÀàÐÍÈ¡¾öÓÚËùÐèСÊýµÄ¾«¶ÈºÍ¿É±äÐÔ¡£
SQL ÖÐСÊýµÄÌåÏÖ
ÔÚ SQL ÖУ¬Ð¡Êýͨ³£ÓÉ DECIMAL »ò NUMERIC Êý¾ÝÀàÐÍÌåÏÖ¡£
DECIMAL
DECIMAL Êý¾ÝÀàÐÍÓÃÓÚÌåÏÖÀο¿¾«¶ÈºÍСÊýλÊýµÄСÊý¡£¾«¶ÈÊÇÖ¸Êý×ÖµÄ×ÜλÊý£¨°üÀ¨Ð¡Êýµã£©£¬Ð¡ÊýλÊýÊÇָСÊýµãÓÒ²àµÄλÊý¡£
ÀýÈ磺
DECIMAL(5,2)
µÇ¼ºó¸´ÖÆ
ÌåÏÖÒ»¸ö³¤¶ÈΪ 5 λ£¬Ð¡ÊýλÊýΪ 2 λµÄСÊý¡£
NUMERIC
NUMERIC Êý¾ÝÀàÐÍÓë DECIMAL ÀàËÆ£¬µ«ÔÊÔÊÐí±ä¾«¶ÈºÍСÊýλÊý¡£ÕâÒâζ×ÅСÊýµÄ³¤¶ÈºÍ¾«¶È¿ÉÒÔÔÚÊý¾Ý²åÈëʱ¶¯Ì¬µ÷½â¡£
ÀýÈ磺
NUMERIC(5,2)
µÇ¼ºó¸´ÖÆ
ÌåÏÖÒ»¸öСÊý£¬¾«¶ÈΪ 5 λ£¬Ð¡ÊýλÊýΪ 2 λ¡£¿ÉÊÇ£¬ÔÚ²åÈëÊý¾Ýʱ£¬Ð¡Êý¿ÉÒÔ¾ßÓвî±ðµÄ¾«¶ÈºÍСÊýλÊý£¬Ö»Òª²»Áè¼ÝÖ¸¶¨µÄÏÞÖÆ¡£
Ñ¡ÔñºÏÊʵÄÀàÐÍ
Ñ¡Ôñ DECIMAL »ò NUMERIC Êý¾ÝÀàÐÍÈ¡¾öÓÚËùÐèµÄСÊýµÄ¾«¶ÈºÍ¿É±äÐÔ¡£¹ØÓÚÀο¿¾«¶ÈºÍСÊýλÊýµÄСÊý£¬Ê¹Óà DECIMAL¡£¹ØÓÚ¾«¶ÈºÍ¿É±äСÊýλÊýµÄСÊý£¬Ê¹Óà NUMERIC¡£
ÒÔÉϾÍÊÇsqlÖÐСÊýÔõôÌåÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡