ÇósqlÓï¾ä
ɾ³ýnorthwindËùÓбíÖÐËùÓеÄÊý¾Ý
SQL code: --ɾ³ýµ±Ç°Êý¾Ý¿âËùÓбíÖеÄÊý¾Ý sp_MSforeachtable 'Delete from ?' sp_MSforeachtable @command1="Delete from ? " sp_MSforeachtable 'Truncate Table ?' http://blog.csdn.net/feixianxxx/archive/2009/08/16/4451842.aspx ²Î¿¼ÎÒ²©¿ÍÌå»á sp_MSforeachtable ºÍsp_MSforeachDB 2¸ö·Ç³£Ç¿´óÓÖΣÏյĴ洢¹ý³Ì ´ø¸øÄãµÄ¿ì¸Ð ²»¹ýһ¥µÄ·½·¨ÓиöÏÞÖÆ ¾ÍÊÇ Èç¹û2±íÓÐÍâ¼üÁªÏµ ÄÇô ¾Í»á³ö´í ¡£¡£ Äã¿ÉÒÔÑ¡Ôñ °ÑÍâ¼ü¶¼É¾³ý È»ºóÖ´ÐÐ ²»¹ýÕâÑù Äã±í¹ØϵҪÖؽ¨ÁË ÒýÓà --È¡³ö¿âÖÐËùÓбí Select name from sysobjects Where OBJECTPROPERTY(id,'IsUserTable')=1 --È»ºóд¸öÑ»·É¾³ý delete from tb ÕâЩ¶¼»á±»Íâ¼ü Ô¼Êøµ½µÄ ¶¥Â¥ÉϵÄ
Ïà¹ØÎÊ´ð£º
ÏÖÔÚÓÐÁ½¸öÒì¹¹µÄsql serverÊý¾Ý¿â,ÎÒÏ뽫µÚÒ»¸ö±íÖеÄÊý¾Ýµ¼Èëµ½µÚ¶þ¸ö±íÖÐ,×Ô¼ºÖ¸¶¨µ¼ÈëÊý¾ÝµÄ×Ö¶Î,ÈçºÎµ¼ÈëÊý¾ÝÄØ,´ó¼ÒÌÖÂÛÒ»ÏÂ? dts¹¤¾ß µ¼Èëµ¼³ö¹¤¾ß. DD ¹þ¹þ£¬¹À¼ÆÕâλÊǵØQIOU¶¼Êܲ»ÁËµÄ Ö±½ÓÐ ......
ÎÒÓÐÒ»¸öÔºÍÈÕ×é³ÉµÄÊý×Ö£¬ÓÐÁ½×éÔºÍÈÕ ÏëÔÚÉí·ÝÖ¤ºÅÖÐÌôÑ¡³öÔڸøÃÁ½×éÔÂÈÕÖ®¼ä³öÉúµÄÈË£¬²»ÖªµÀÓ¦¸ÃÔõôд. Éí·ÝÖ¤ºÅÓпÉÄÜÊÇ15λ»òÕß18λ ÔÂÈÕ×éºÏµÄÐÎʽÈçÏ 10-17/04-20 ÔÂ-ÈÕ/ÔÂ- ......
»ìSQL°æÕâô¾ÃÁË£¬·ÖÏíÒ»µã×ÊÁÏ sql serverµÄÏà¹ØÈÏÖ¤µÄÊÔÌ⼯ºÏ£¬°æÓÑÓл¹ÔÚѧУµÄ»°¾ÍÏÂÔØÏÂÀ´Óлú»á¿¼ÊÔһϣ¬±Ï¾¹350Ôª´ó¼Ò»¹ÊǸºµ£µÃÆðµÄ£¬½«À´±ÏÒµºóÒ²ÊÇÒ»¸öºÃÒ»µãµÄÖ¤ÊéÖ¤Ã÷ Èç¹û×¼±¸×¨×¢ÓÚÕâ ......
ÎÒÓÐÒ»Õűí Create table abc (ID int primary key, A varchar(20), B varchar(20)); Êý¾Ý¿âÖÐAºÍB×ֶβ»ÄÜÖظ´£¬Ò²¾ÍÊDZÈÈçÎÒ²åÈëÒ»Ìõ¼Ç¼ £ºinsert into abc(ID, A, B) values(1, abc123, abc456); ÎÒÔÚ²åÈëµÚ¶ ......