×ðÁú¿­Ê±¹ÙÍøµÇ¼

sqlÖÐdeclareÊÇʲôÒâ˼

declare Óï¾äÓÃÓÚÔÚ sql ÖÐÉùÃ÷±äÁ¿ £¬¼´´æ´¢ÖµµÄÊý¾ÝÈÝÆ÷¡£±äÁ¿ÀàÐÍ°üÀ¨ÕûÊý¡¢Ð¡Êý¡¢×Ö·û´®¡¢ÈÕÆÚ¡¢²¼¶ûÖµµÈ¡£±äÁ¿ÃüÃûÒÔ @·ûºÅ¿ªÍ· £¬²¢×ñÕÕÌض¨ÃüÃû¹æÔò¡£ÉùÃ÷±äÁ¿ÓÐÖúÓÚ´úÂë¿É¶ÁÐÔ¡¢´úÂëÖØÓúÍÐÔÄÜÓÅ»¯¡£

SQL ÖÐµÄ DECLARE

DECLARED µÄ¼ÄÒå

DECLARE Óï¾äÓÃÓÚÔÚ SQL ÖÐÉùÃ÷±äÁ¿¡£±äÁ¿ÊÇ´æ´¢ÖµµÄÊý¾ÝÈÝÆ÷ £¬¿ÉÒÔÔÚÕû¸ö SQL Óï¾äÖÐʹÓá£

Óï·¨

DECLARE  ;

µÇ¼ºó¸´ÖÆ

Ó÷¨

DECLARE @age INT;
SET @age = 25;
SELECT @age;

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖÐ £¬ÎÒÃÇÉùÃ÷ÎúÒ»¸öÃûΪ @age µÄÕûÊý±äÁ¿ £¬²¢½«Öµ 25 ¸¶ÓëËü¡£È»ºó £¬ÎÒÃÇ¿ÉÒÔʹÓà @age ±äÁ¿À´¼ìË÷´æ´¢µÄÖµ¡£

±äÁ¿µÄÀàÐÍ

SQL ÖеıäÁ¿¿ÉÒÔ¾ßÓвî±ðµÄÊý¾ÝÀàÐÍ £¬°üÀ¨£º

ÕûÊý (INT)

СÊý (NUMERIC)

×Ö·û´® (CHAR/VARCHAR)

ÈÕÆÚ (DATE/TIME)

²¼¶ûÖµ (BIT)

±äÁ¿µÄÃüÃû¹æÔò

SQL ±äÁ¿Ãû³Æ±ØÐèÒÔ @·ûºÅ¿ªÍ· £¬²¢ÇÒÖ»ÄÜ°üÀ¨×Öĸ¡¢Êý×ÖºÍÏ»®Ïß¡£±äÁ¿Ãû³Æ²»¿ÉÓë SQL ±£´æ×Ö³åÍ»¡£

Óŵã

ʹÓà DECLARE Óï¾äÉùÃ÷±äÁ¿ÌṩÁËÒÔÏÂÓŵ㣺

´úÂë¿É¶ÁÐÔ£ºËüʹ´úÂë¸ü¾ß¿É¶ÁÐÔ £¬ÓÉÓÚ±äÁ¿Ãû³Æ¸ü¾ßÐÎòÐÔÇÒÒ×ÓÚÃ÷È·¡£

´úÂëÖØÓ㺱äÁ¿¿ÉÒÔ´æ´¢¾­³£Ê¹ÓõÄÖµ £¬Õâ¿ÉÒÔïÔÌ­´úÂëÖظ´¡£

ÐÔÄÜÓÅ»¯£ºÍ¨¹ý½«Öµ´æ´¢ÔÚ±äÁ¿ÖÐ £¬¿ÉÒÔ×èÖ¹¶à´ÎÔÚÊý¾Ý¿âÖмìË÷ËüÃÇ £¬´Ó¶øÌá¸ßÐÔÄÜ¡£

ÒÔÉϾÍÊÇsqlÖÐdeclareÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ