{"id":349,"date":"2023-09-16T10:44:54","date_gmt":"2023-09-16T02:44:54","guid":{"rendered":""},"modified":"2023-09-16T15:50:11","modified_gmt":"2023-09-16T07:50:11","slug":"sql-server%e6%88%aa%e5%8f%96%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%87%bd%e6%95%b0%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/mushiming.com\/349.html","title":{"rendered":"SQL Server\u622a\u53d6\u5b57\u7b26\u4e32\u51fd\u6570\u64cd\u4f5c"},"content":{"rendered":"

\u76ee\u5f55<\/strong><\/p>\n

\n

1\u3001SUBSTRING()\u51fd\u6570<\/p>\n

2\u3001LEFT()\u51fd\u6570<\/p>\n

\u00a03\u3001RIGHT()\u51fd\u6570<\/p>\n

\u00a04\u3001CHARINDEX()\u51fd\u6570<\/p>\n

\u00a05\u3001LEN\u51fd\u6570<\/p>\n

\n


\n

1\u3001SUBSTRING()\u51fd\u6570<\/h3>\n

        \u542b\u4e49\uff1a\u4ece\u6307\u5b9a\u4f4d\u7f6e\u5f00\u59cb\u622a\u53d6\u6307\u5b9a\u6570\u91cf\u7684\u5b57\u7b26\u3002<\/p>\n

        \u4f7f\u7528\uff1aSUBSTRING(\u539f\u5b57\u7b26<\/span>,\u622a\u53d6\u5b57\u7b26\u7684\u8d77\u59cb\u4f4d\u7f6e<\/span>,\u622a\u53d6\u5b57\u7b26\u6570\u91cf<\/span>)<\/p>\n

        \u4e3e\u4f8b\uff1a<\/p>\n

                1\u3001\u622a\u53d6\u5b57\u7b26\u7684\u8d77\u59cb\u4f4d\u7f6e<\/span>\u662f\u4ece1\u5f00\u59cb\u7684\uff0c\u4e3a0\u7684\u8bdd\u622a\u53d6\u7684\u5b57\u7b26\u6570\u91cf\u4f1a\u51cf1\u3002<\/span><\/p>\n

                2\u3001<\/span>\u622a\u53d6\u5b57\u7b26\u6570\u91cf<\/span>\u53ef\u4ee5\u4e3a0\uff0c\u4f46\u662f\u4e3a0\u7684\u8bdd\u5f97\u5230\u7684\u7ed3\u679c\u5c31\u662f\u7a7a\uff0c\u4e0d\u53ef\u4ee5\u4e3a\u8d1f\u6570\u3002<\/span><\/p>\n

\"SQL<\/p>\n

2\u3001LEFT()\u51fd\u6570<\/h3>\n

        \u542b\u4e49\uff1a \u4ece\u5b57\u7b26\u5de6\u8fb9\u7b2c1\u4f4d\u5f00\u59cb\u622a\u53d6\u6307\u5b9a\u6570\u91cf\u7684\u5b57\u7b26\u3002<\/p>\n

        \u4f7f\u7528\uff1aLEFT(\u539f\u5b57\u7b26<\/span>,<\/span>\u622a\u53d6\u5b57\u7b26\u6570\u91cf<\/span>)<\/p>\n

        \u4e3e\u4f8b\uff1a<\/p>\n

\"SQL<\/p>\n

 3\u3001RIGHT()\u51fd\u6570<\/h3>\n

        \u542b\u4e49\uff1a \u4ece\u5b57\u7b26\u53f3\u8fb9\u7b2c\u6700\u540e1\u4f4d\u5f00\u59cb\u5f80\u524d\u622a\u53d6\u6307\u5b9a\u6570\u91cf\u7684\u5b57\u7b26\u3002<\/p>\n

        \u4f7f\u7528\uff1aRIGHT(\u539f\u5b57\u7b26<\/span>,<\/span>\u622a\u53d6\u5b57\u7b26\u6570\u91cf<\/span>)<\/p>\n

        \u4e3e\u4f8b\uff1a<\/p>\n

\"SQL<\/p>\n

 4\u3001CHARINDEX()\u51fd\u6570<\/h3>\n

        \u542b\u4e49\uff1a \u8fd4\u56de\u6307\u5b9a\u5b57\u7b26\u5728\u539f\u59cb\u503c\u4e2d\u7684\u4f4d\u7f6e\u3002<\/p>\n

        \u4f7f\u7528\uff1aCHARINDEX(\u6307\u5b9a\u5b57\u7b26<\/span>,\u539f\u5b57\u7b26<\/span>)<\/p>\n

        \u4e3e\u4f8b\uff1a<\/p>\n

                1\u3001\u6307\u5b9a\u5b57\u7b26<\/span>\u53ef\u4ee5\u591a\u4e2a\u5b57\u7b26\uff0c\u90a3\u6837\u53ea\u4f1a\u8fd4\u56de\u6307\u5b9a\u5b57\u7b26\u6700\u5de6\u5b57\u7b26\u7684\u4f4d\u7f6e\u3002<\/p>\n

\"SQL<\/p>\n<\/p>\n

 5\u3001LEN\u51fd\u6570<\/h3>\n

        \u542b\u4e49\uff1a \u8fd4\u56de\u6307\u5b9a\u5b57\u6bb5\u7684\u957f\u5ea6\u3002<\/p>\n

        \u4f7f\u7528\uff1aLEN(\u5b57\u6bb5<\/span>)<\/p>\n

        \u4e3e\u4f8b\uff1a<\/p>\n

                1\u3001\u4e0d\u77e5\u9053\u8981\u622a\u53d6\u591a\u5c11\u6570\u91cf\u7684\u65f6\u5019\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n

\"SQL<\/p>\n<\/p>\n

<\/h3>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"Sqlserver\u622a\u53d6\u5b57\u7b26\u4e32_sqlserver\u622a\u53d6\u5b57\u7b26\u4e32","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/349"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=349"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/349\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}