{"id":173,"date":"2012-02-18T11:21:22","date_gmt":"2012-02-18T03:21:22","guid":{"rendered":"http:\/\/www.withonly.com\/?p=173"},"modified":"2012-02-18T11:21:22","modified_gmt":"2012-02-18T03:21:22","slug":"%e6%b8%85%e7%a9%ba%e6%95%b0%e6%8d%ae%e5%ba%93%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/blog.5danyuan.com\/?p=173","title":{"rendered":"\u6e05\u7a7a\u6570\u636e\u5e93\u8868"},"content":{"rendered":"<p>\u6700\u8fd1\u5728\u4e0d\u65ad\u5730\u6e05\u7a7a\u6570\u636e\u5e93\u7684\u8868\uff0c\u4eba\u5de5\u64cd\u4f5c\u8d77\u6765\u7a0d\u663e\u7684\u9ebb\u70e6\u4e86\u70b9\uff0c\u653e\u4e0aSQL\u8bed\u53e5\uff0c\u4ee5\u5907\u540e\u7528\u3002<\/p>\n<p>&#8211;\/\u7b2c1\u6b65**********\u5220\u9664\u6240\u6709\u8868\u7684\u5916\u952e\u7ea6\u675f*************************\/<\/p>\n<p>DECLARE c1 cursor for select &#8216;alter table [&#8216;+ object_name(parent_obj) + &#8216;] drop constraint [&#8216;+name+&#8217;]; &#8216; from sysobjects where xtype = &#8216;F&#8217; open c1 declare @c1 varchar(8000) fetch next from c1 into @c1 while(@@fetch_status=0) begin exec(@c1) fetch next from c1 into @c1 end close c1 deallocate c1<\/p>\n<p>&#8211;\/\u7b2c2\u6b65**********\u5220\u9664\u6240\u6709\u8868*************************\/<\/p>\n<p>declare @sql varchar(8000) while (select count(*) from sysobjects where type=&#8217;U&#8217;)&gt;0 begin SELECT @sql=&#8217;drop table &#8216; + name FROM sysobjects WHERE (type = &#8216;U&#8217;) ORDER BY &#8216;drop table &#8216; + name exec(@sql) end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u4e0d\u65ad\u5730\u6e05\u7a7a\u6570\u636e\u5e93\u7684\u8868\uff0c\u4eba\u5de5\u64cd\u4f5c\u8d77\u6765\u7a0d\u663e\u7684\u9ebb\u70e6\u4e86\u70b9\uff0c\u653e\u4e0aSQL\u8bed\u53e5\uff0c\u4ee5\u5907\u540e\u7528\u3002 &#8211;\/\u7b2c1\u6b65** [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[58,59],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-daily","tag-sql","tag-59"],"_links":{"self":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":0,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}