×ðÁú¿­Ê±

sqlÖÐ@µÄÒâ˼

sql ÖÐµÄ @ ·ûºÅÌåÏÖÒ»¸ö²ÎÊýµÄռλ·û £¬ÓÃÓÚ´æ´¢¶¯Ì¬»òδָ¶¨µÄÖµ £¬ÏêϸʹÓó¡¾°°üÀ¨´æ´¢Àú³Ì/º¯Êý¡¢¶¯Ì¬ sql ºÍÅÌÎʲÎÊý»¯¡£

SQL ÖÐ @ µÄ¼ÄÒå

SQL ÖÐµÄ @ ·ûºÅͨ³£ÌåÏÖÒ»¸ö²ÎÊýµÄռλ·û £¬ÓÃÓÚ´æ´¢¶¯Ì¬»òδָ¶¨µÄÖµ¡£

ʹÓó¡¾°

@ ·ûºÅÆÕ±éÓÃÓÚÖÖÖÖ SQL Óï¾äÖÐ £¬°üÀ¨£º

´æ´¢Àú³ÌºÍº¯Êý£º½«ÊäÈë»òÊä³ö²ÎÊýת´ï¸ø´æ´¢Àú³Ì»òº¯Êý¡£

¶¯Ì¬ SQL£º½¨É趯̬ SQL Óï¾ä £¬ÆäÖвÎÊýµÄÖµÔÚÔËÐÐʱȷ¶¨¡£

ÅÌÎʲÎÊý»¯£º×ª´ïÖµÀ´¹ýÂË»òÏÞÖÆÅÌÎÊЧ¹û £¬×èÖ¹ SQL ×¢Èë¹¥»÷¡£

Óï·¨

ÔÚ SQL ÖÐʹÓà @ ·ûºÅʱ £¬Í¨³£×ñÕÕÒÔÏÂÓï·¨£º

@parameter_name

µÇ¼ºó¸´ÖÆ

ÀýÈ磺

SELECT * FROM table_name WHERE id = @id

µÇ¼ºó¸´ÖÆ

ÏêϸʹÓÃ

´æ´¢Àú³ÌºÍº¯Êý£ºÔÚ½¨Éè´æ´¢Àú³Ì»òº¯Êýʱ £¬¿ÉÒÔÔÚ²ÎÊýÁбíÖÐÖ¸¶¨´øÓÐ @ ·ûºÅµÄ²ÎÊý¡£ÀýÈ磺

CREATE PROCEDURE my_proc (@param1 int, @param2 varchar(50))

µÇ¼ºó¸´ÖÆ

¶¯Ì¬ SQL£ºÊ¹Óà EXEC Óï¾äÖ´Ðж¯Ì¬ SQL ʱ £¬¿ÉÒÔʹÓà @ ·ûºÅת´ï²ÎÊý¡£ÀýÈ磺

EXEC (@sql_statement)

µÇ¼ºó¸´ÖÆ

ÅÌÎʲÎÊý»¯£ºÔÚÅÌÎÊÖÐʹÓà @ ·ûºÅÌæ»»Ìض¨Öµ £¬¿ÉÒÔÌá¸ßÐÔÄܺÍÇå¾²ÐÔ¡£ÀýÈ磺

SELECT * FROM table_name WHERE id = ?

µÇ¼ºó¸´ÖÆ

×¢ÖØ£º²î±ðÊý¾Ý¿âÖÎÀíϵͳ (DBMS) ¿ÉÄÜ¶Ô @ ·ûºÅµÄ´¦Öóͷ£·½·¨ÓÐËù²î±ð £¬Òò´ËÇë²ÎÔÄÌض¨ DBMS µÄÎĵµÒÔÏàʶÏêϸÓ÷¨¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

13452372176

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

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

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿