{"id":168039,"date":"2024-11-06T09:00:24","date_gmt":"2024-11-06T01:00:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/168039\/"},"modified":"2024-11-06T09:00:25","modified_gmt":"2024-11-06T01:00:25","slug":"%e5%88%97mssql%e9%87%8d%e5%91%bd%e5%90%8d%e5%88%97%ef%bc%9a%e9%80%9a%e9%81%8e%e5%af%a6%e7%8f%be%e8%bc%95%e9%ac%86%e6%94%b9%e8%ae%8a%e8%a1%a8%e7%b5%90%e6%a7%8b%ef%bc%88mssql-%e9%87%8d%e5%91%bd%e5%90%8d","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/168039\/","title":{"rendered":"\u5217MSSQL\u91cd\u547d\u540d\u5217\uff1a\u901a\u904e\u5be6\u73fe\u8f15\u9b06\u6539\u8b8a\u8868\u7d50\u69cb\uff08mssql \u91cd\u547d\u540d\uff09"},"content":{"rendered":"<h1 id=\"%e5%88%97mssql%e9%87%8d%e5%91%bd%e5%90%8d%e5%88%97%ef%bc%9a%e9%80%9a%e9%81%8e%e5%af%a6%e7%8f%be%e8%bc%95%e9%ac%86%e6%94%b9%e8%ae%8a%e8%a1%a8%e7%b5%90%e6%a7%8b%ef%bc%88mssql-%e9%87%8d%e5%91%bd%e5%90%8d-OpwLfIiAUK\">\u5217MSSQL\u91cd\u547d\u540d\u5217\uff1a\u901a\u904e\u5be6\u73fe\u8f15\u9b06\u6539\u8b8a\u8868\u7d50\u69cb\uff08mssql \u91cd\u547d\u540d\uff09<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0c\u8868\u7d50\u69cb\u7684\u8b8a\u66f4\u662f\u5e38\u898b\u7684\u9700\u6c42\u4e4b\u4e00\u3002\u7279\u5225\u662f\u5728\u4f7f\u7528 Microsoft SQL Server\uff08MSSQL\uff09\u6642\uff0c\u91cd\u547d\u540d\u5217\u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u4f46\u537b\u975e\u5e38\u91cd\u8981\u7684\u64cd\u4f5c\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5982\u4f55\u5728 MSSQL \u4e2d\u91cd\u547d\u540d\u5217\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e9%87%8d%e5%91%bd%e5%90%8d%e5%88%97%ef%bc%9f-OpwLfIiAUK\">\u70ba\u4ec0\u9ebc\u9700\u8981\u91cd\u547d\u540d\u5217\uff1f<\/h2>\n<p>\u91cd\u547d\u540d\u5217\u7684\u539f\u56e0\u591a\u7a2e\u591a\u6a23\uff0c\u53ef\u80fd\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u6539\u5584\u53ef\u8b80\u6027\uff1a\u6709\u6642\u5019\uff0c\u5217\u7684\u540d\u7a31\u53ef\u80fd\u4e0d\u5920\u76f4\u89c0\uff0c\u91cd\u547d\u540d\u53ef\u4ee5\u4f7f\u5176\u66f4\u5177\u63cf\u8ff0\u6027\u3002<\/li>\n<li>\u7b26\u5408\u696d\u52d9\u9700\u6c42\uff1a\u96a8\u8457\u696d\u52d9\u7684\u767c\u5c55\uff0c\u6578\u64da\u7d50\u69cb\u53ef\u80fd\u9700\u8981\u8abf\u6574\u4ee5\u9069\u61c9\u65b0\u7684\u9700\u6c42\u3002<\/li>\n<li>\u907f\u514d\u6df7\u6dc6\uff1a\u5728\u591a\u500b\u8868\u4e2d\u53ef\u80fd\u5b58\u5728\u76f8\u4f3c\u7684\u5217\u540d\u7a31\uff0c\u91cd\u547d\u540d\u53ef\u4ee5\u5e6b\u52a9\u5340\u5206\u5b83\u5011\u3002<\/li>\n<\/ul>\n<h2 id=\"mssql%e4%b8%ad%e9%87%8d%e5%91%bd%e5%90%8d%e5%88%97%e7%9a%84%e5%9f%ba%e6%9c%ac%e8%aa%9e%e6%b3%95-OpwLfIiAUK\">MSSQL\u4e2d\u91cd\u547d\u540d\u5217\u7684\u57fa\u672c\u8a9e\u6cd5<\/h2>\n<p>\u5728 MSSQL \u4e2d\uff0c\u91cd\u547d\u540d\u5217\u7684\u4e3b\u8981\u65b9\u6cd5\u662f\u4f7f\u7528 <code>sp_rename<\/code> \u5b58\u5132\u904e\u7a0b\u3002\u5176\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>EXEC sp_rename '\u8868\u540d.\u820a\u5217\u540d', '\u65b0\u5217\u540d', 'COLUMN';<\/code><\/pre>\n<p>\u9019\u88e1\u7684\u53c3\u6578\u89e3\u91cb\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u8868\u540d<\/strong>\uff1a\u9700\u8981\u91cd\u547d\u540d\u5217\u7684\u8868\u7684\u540d\u7a31\u3002<\/li>\n<li><strong>\u820a\u5217\u540d<\/strong>\uff1a\u7576\u524d\u7684\u5217\u540d\u7a31\u3002<\/li>\n<li><strong>\u65b0\u5217\u540d<\/strong>\uff1a\u5e0c\u671b\u5c07\u5217\u91cd\u547d\u540d\u70ba\u7684\u65b0\u540d\u7a31\u3002<\/li>\n<li><strong>COLUMN<\/strong>\uff1a\u6307\u5b9a\u8981\u91cd\u547d\u540d\u7684\u5c0d\u8c61\u985e\u578b\u70ba\u5217\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%af%a6%e9%9a%9b%e7%a4%ba%e4%be%8b-OpwLfIiAUK\">\u5be6\u969b\u793a\u4f8b<\/h2>\n<p>\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u540d\u70ba <code>Employees<\/code> \u7684\u8868\uff0c\u5176\u4e2d\u6709\u4e00\u500b\u5217\u540d\u70ba <code>EmpName<\/code>\uff0c\u6211\u5011\u5e0c\u671b\u5c07\u5176\u91cd\u547d\u540d\u70ba <code>EmployeeName<\/code>\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>EXEC sp_rename 'Employees.EmpName', 'EmployeeName', 'COLUMN';<\/code><\/pre>\n<p>\u57f7\u884c\u4e0a\u8ff0\u547d\u4ee4\u5f8c\uff0c<code>EmpName<\/code> \u5217\u5c07\u88ab\u91cd\u547d\u540d\u70ba <code>EmployeeName<\/code>\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-OpwLfIiAUK\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u91cd\u547d\u540d\u5217\u6642\uff0c\u6709\u5e7e\u500b\u6ce8\u610f\u4e8b\u9805\u9700\u8981\u8003\u616e\uff1a<\/p>\n<ul>\n<li>\u91cd\u547d\u540d\u5217\u53ef\u80fd\u6703\u5f71\u97ff\u4f9d\u8cf4\u65bc\u8a72\u5217\u7684\u8996\u5716\u3001\u5b58\u5132\u904e\u7a0b\u6216\u89f8\u767c\u5668\uff0c\u56e0\u6b64\u5728\u9032\u884c\u6b64\u64cd\u4f5c\u4e4b\u524d\uff0c\u61c9\u6aa2\u67e5\u6240\u6709\u76f8\u95dc\u7684\u5c0d\u8c61\u3002<\/li>\n<li>\u5728\u91cd\u547d\u540d\u5217\u5f8c\uff0c\u61c9\u66f4\u65b0\u61c9\u7528\u7a0b\u5e8f\u4ee3\u78bc\uff0c\u4ee5\u78ba\u4fdd\u5b83\u5011\u4f7f\u7528\u65b0\u7684\u5217\u540d\u7a31\u3002<\/li>\n<li>\u5728\u751f\u7522\u74b0\u5883\u4e2d\u9032\u884c\u6b64\u985e\u66f4\u6539\u6642\uff0c\u5efa\u8b70\u5148\u5728\u6e2c\u8a66\u74b0\u5883\u4e2d\u9032\u884c\u9a57\u8b49\uff0c\u4ee5\u907f\u514d\u6f5b\u5728\u7684\u554f\u984c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-OpwLfIiAUK\">\u7d50\u8ad6<\/h2>\n<p>\u91cd\u547d\u540d MSSQL \u4e2d\u7684\u5217\u662f\u4e00\u500b\u7c21\u55ae\u800c\u6709\u6548\u7684\u65b9\u5f0f\u4f86\u6539\u5584\u6578\u64da\u5eab\u7684\u53ef\u8b80\u6027\u548c\u7d50\u69cb\u3002\u901a\u904e\u4f7f\u7528 <code>sp_rename<\/code> \u5b58\u5132\u904e\u7a0b\uff0c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u4ee5\u8f15\u9b06\u5730\u9032\u884c\u9019\u4e00\u64cd\u4f5c\u3002\u7136\u800c\uff0c\u5728\u9032\u884c\u4efb\u4f55\u7d50\u69cb\u8b8a\u66f4\u4e4b\u524d\uff0c\u52d9\u5fc5\u8003\u616e\u5230\u6240\u6709\u4f9d\u8cf4\u95dc\u4fc2\u548c\u6f5b\u5728\u5f71\u97ff\uff0c\u4ee5\u78ba\u4fdd\u7cfb\u7d71\u7684\u7a69\u5b9a\u6027\u548c\u4e00\u81f4\u6027\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u7528\u6236\u7684\u9700\u6c42\u3002\u7121\u8ad6\u662f\u6578\u64da\u5eab\u7ba1\u7406\u9084\u662f\u5176\u4ed6\u61c9\u7528\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u5c0d\u65bc\u696d\u52d9\u7684\u6210\u529f\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u5728MSSQL\u4e2d\u8f15\u9b06\u91cd\u547d\u540d\u5217\uff0c\u5be6\u73fe\u8868\u7d50\u69cb\u7684\u9748\u6d3b\u8b8a\u66f4\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-168039","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=168039"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168039\/revisions"}],"predecessor-version":[{"id":168040,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168039\/revisions\/168040"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=168039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=168039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=168039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}