{"id":547,"date":"2010-10-01T03:44:04","date_gmt":"2010-10-01T03:44:04","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=547"},"modified":"2010-10-01T03:44:04","modified_gmt":"2010-10-01T03:44:04","slug":"sqlserver%e7%b3%bb%e7%bb%9f%e8%a1%a8%e4%b8%8e%e4%b8%80%e4%ba%9b%e5%b1%9e%e6%80%a7","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/01\/sqlserver%e7%b3%bb%e7%bb%9f%e8%a1%a8%e4%b8%8e%e4%b8%80%e4%ba%9b%e5%b1%9e%e6%80%a7\/","title":{"rendered":"SqlServer\u7cfb\u7edf\u8868\u4e0e\u4e00\u4e9b\u5c5e\u6027"},"content":{"rendered":"<p>\u7cfb\u7edf\u8868\u7684\u4f5c\u7528\uff1a\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8868\u5bf9\u81ea\u5df1\u586b\u5145\u7684\u6570\u636e\u8fdb\u884c\u64cd\u4f5c\u3002\u800c\u5bf9sql server\u6765\u8bf4\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8868\u5c31\u76f8\u5f53\u4e8e\u4e3a\u7cfb\u7edf\u8868\u586b\u5145\u7684\u6570\u636e\uff0c\u6545\u7528\u7cfb\u7edf\u8868\u6765\u64cd\u4f5c\u7528\u6237\u6570\u636e\u5e93\uff0c<br \/>\n\u6570\u636e\u8868\uff0c\u5b58\u50a8\u8fc7\u7a0b\u7b49\u6570\u636e\u3002 \u7cfb\u7edf\u8868\u64cd\u4f5c\u7528\u6237\u81ea\u5b9a\u4e49\u8868\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u8868\u64cd\u4f5c\u5916\u6765\u7684\u6570\u636e\u3002<\/p>\n<p>1\uff0csysobjects\u8868\uff1a\u4e07\u7269\u7686\u5bf9\u8c61\uff0c\u8fd9\u662f\u4e00\u4e2a\u7cfb\u7edf\u5bf9\u8c61\u8868\u3002\u8868\uff0c\u5b58\u50a8\u8fc7\u7a0b,\u89e6\u53d1\u5668\u90fd\u662f\u5bf9\u8c61\uff0c\u90fd\u5b58\u5728\u6b64\u8868\u5185\u3002\u6b64\u8868\u7528crdate \u7b49\u4fdd\u5b58 \u5bf9\u8c61\u7684\u521b\u5efa\u65e5\u671f\u3002<br \/>\n\u67e5\u627e\u7528\u6237\u8868\uff1a select *?? from sysobjects where xtype = &#8216;U&#8217; AND status &gt;0<br \/>\n??????? \u56e0dtproperties\u867d\u662f\u7cfb\u7edf\u8868\uff0c\u4f46\u7c7b\u578b\u4e3a&#8217;U&#8217;, \u4f46status\u4e3a\u8d1f\u6570\uff0c\u6545\u5f97\u5230\u7eaf\u51c0\u7684\u7528\u6237\u8868\u65f6\u8981\u5c06\u5176\u9664\u53bb\u3002dtproperties\u8fd9\u4e2a\u8868\u91cc\u4fdd\u5b58\u7684\u662f\u5173\u7cfb\u56fe<br \/>\n\u67e5\u5b58\u50a8\u8fc7\u7a0b\uff1a select *?? from sysobjects where xtype = &#8216;P&#8217;<br \/>\n\u6ce8\uff1aType\u662f\u5728SQL SERVER 6.0\u5c31\u6709\u7684\uff0cxType\u5728SQL SERVER 7.0\u624d\u51fa\u73b0\uff0cType\u7684\u4fdd\u7559\u53ea\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002<br \/>\n?????<br \/>\n?????? \u76f8\u5173\u51fd\u6570\uff1aobject_id(&#8216;mytable&#8217;)\uff0c\u67e5\u51fa\u5bf9\u8c61\u540d\u5728sysobjects\u8868\u4e2d\u7684id\u503c<br \/>\n??????????????????????? object_id ( object_id ), \u636eid\u67e5\u51fa\u5bf9\u8c61\u540d<\/p>\n<p>2\uff0csys.servers \u67e5\u770b\u6240\u6709\u672c\u5730\u670d\u52a1\u5668\u53ca\u94fe\u63a5\u670d\u52a1\u5668 select * from master..sysservers \u8be5\u8868\u53ea\u5b58\u50a8\u5728 master \u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>3\uff0csys.databases \u67e5\u8be2\u975esa\u521b\u5efa\u7684\u6240\u6709\u6570\u636e\u5e93 select * from master..sysdatabases \u8be5\u8868\u53ea\u5b58\u50a8\u5728 master \u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>4\uff0c sys.columns \u83b7\u53d6\u8868\u6216\u89c6\u56fe\u7684\u6240\u6709\u5b57\u6bb5\uff0c\u5b58\u50a8\u8fc7\u7a0b\u6216\u51fd\u6570\u7684\u6240\u6709\u53c2\u6570 select name from syscolumns where id=object_id(&#8216;\u8868\u540d&#8217;)<\/p>\n<p>5\uff0csys.indexes \u6570\u636e\u5e93\u4e2d\u7684\u6bcf\u4e2a\u7d22\u5f15\u3002<\/p>\n<p>6\uff0c sys.logins? \u6bcf\u4e2a\u767b\u5f55\u5e10\u6237\u5728\u8868\u4e2d\u5360\u4e00\u884c\u3002<\/p>\n<p>7,?? sys.processes \u6570\u636e\u5e93\u8fdb\u7a0b\u4fe1\u606f \uff0c\u53ea\u5b58\u50a8\u5728 master \u6570\u636e\u5e93\u4e2d\u3002<br \/>\n?? \u67e5\u770b\u7528\u6237\u8fdb\u7a0b\u4fe1\u606f select spid,uid,syslogins.name,login_time,net_address from sysprocesses,syslogins where sys.processes.sid=syslogins.sid<\/p>\n<p>8\uff0csysdepends? \u67e5\u770b\u4e0e\u67d0\u4e00\u4e2a\u8868\u76f8\u5173\u7684\u89c6\u56fe\u3001\u5b58\u50a8\u8fc7\u7a0b\u3001\u51fd\u6570? select * from sysdepends where depid=object_id(&#8216;\u8868\u540d&#8217;)<\/p>\n<p>9\uff0csysmessages SQL SERVER\u8fd4\u56de\u7684\u5185\u90e8\u9519\u8bef\u90fd\u6709\u5728\u8fd9\u91cc\uff0c\u53ef\u81ea\u884c\u4fee\u6539\uff0c\u5f53\u9519\u8bef\u53d1\u751f\u65f6\u663e\u793a\u81ea\u5df1\u6307\u793a\u7684\u4fe1\u606f\u3002<\/p>\n<p>10\uff0csysfiles \u4fdd\u5b58\u5f53\u524d\u6570\u636e\u5e93\u6240\u5728\u6587\u4ef6\u5927\u5c0f\uff0c\u8def\u5f84\u7b49\u4fe1\u606f\u3002<\/p>\n<p>11\uff0cINFORMATION_SCHEMA \u5f53\u524d\u6570\u636e\u5e93\u7684\u6bcf\u4e2a CHECK \u7ea6\u675f\u5728\u8be5\u89c6\u56fe\u4e2d\u5360\u4e00\u884c\u3002\u8be5\u4fe1\u606f\u67b6\u6784\u89c6\u56fe\u8fd4\u56de\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709\u6743\u9650\u7684\u5bf9\u8c61\u7684\u6709\u5173\u4fe1\u606f\u3002<br \/>\n?????? \u67e5\u8be2\u67d0\u4e2a\u8868\u7684\u54ea\u4e9b\u5b57\u6bb5\u4e0d\u5141\u8bb8\u4e3a\u7a7a<br \/>\n??????????? select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where IS_NULLABLE=&#8217;NO&#8217; and TABLE_NAME=&#8217;bdorder&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7cfb\u7edf\u8868\u7684\u4f5c\u7528\uff1a\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8868\u5bf9\u81ea\u5df1\u586b\u5145\u7684\u6570\u636e\u8fdb\u884c\u64cd\u4f5c\u3002\u800c\u5bf9sql server\u6765\u8bf4\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8868\u5c31\u76f8\u5f53\u4e8e\u4e3a\u7cfb [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-547","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=547"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/547\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}