{"id":360,"date":"2023-09-16T10:44:51","date_gmt":"2023-09-16T02:44:51","guid":{"rendered":""},"modified":"2023-09-18T11:50:02","modified_gmt":"2023-09-18T03:50:02","slug":"sql-server%e4%b8%ad%e6%88%aa%e5%8f%96%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%9a%84%e5%b8%b8%e7%94%a8%e5%87%bd%e6%95%b0-left%e3%80%81right%e3%80%81substring","status":"publish","type":"post","link":"https:\/\/mushiming.com\/360.html","title":{"rendered":"SQL server\u4e2d\u622a\u53d6\u5b57\u7b26\u4e32\u7684\u5e38\u7528\u51fd\u6570--LEFT()\u3001RIGHT()\u3001SUBSTRING()"},"content":{"rendered":"
\u4e00\u3001sql server\u63d0\u4f9b\u4e86\u4e09\u79cd\u5e38\u7528\u622a\u53d6\u5b57\u7b26\u4e32\u65b9\u6cd5\uff0cLEFT()\u3001RIGHT()\u3001SUBSTRING()<\/p>\n
1\u3001LEFT()\u51fd\u6570
\u8bed\u6cd5\uff1aLEFT(character,integer)
\u6ce8\u91ca\uff1a\u53c2\u65701\uff1a\u8981\u622a\u53d6\u7684\u5b57\u7b26\u4e32\uff0c\u53c2\u65702\uff1a\u622a\u53d6\u5b57\u7b26\u4e2a\u6570
\u8bf4\u660e\uff1a\u8fd4\u56de\u4ece\u5b57\u7b26\u4e32\u5de6\u8fb9\u5f00\u59cb\u6307\u5b9a\u4e2a\u6570\u7684\u5b57\u7b26
select LEFT('SqlServer_2014',3)
\u7ed3\u679c\uff1aSql<\/p>\n
2\u3001RIGHT()\u51fd\u6570
\u8bed\u6cd5\uff1aRIGHT(character,integer)
\u6ce8\u91ca\uff1a\u53c2\u65701\uff1a\u8981\u622a\u53d6\u7684\u5b57\u7b26\u4e32\uff0c\u53c2\u65702\uff1a\u622a\u53d6\u5b57\u7b26\u4e2a\u6570
\u8bf4\u660e\uff1a\u8fd4\u56de\u4ece\u5b57\u7b26\u4e32\u53f3\u8fb9\u5f00\u59cb\u6307\u5b9a\u4e2a\u6570\u7684\u5b57\u7b26
select RIGHT('SqlServer_2014',4)
\u7ed3\u679c\uff1a2014<\/p>\n
3\u3001SUBSTRING()\u51fd\u6570
\u8bed\u6cd5\uff1aSUBSTRING(character,start,length)
\u6ce8\u91ca\uff1a\u53c2\u65701\uff1a\u8981\u622a\u53d6\u7684\u5b57\u7b26\u4e32\uff0c\u53c2\u65702\uff1a\u5f00\u59cb\u622a\u53d6\u7684\u4e0b\u6807\uff0c\u53c2\u65703\uff1a\u622a\u53d6\u7684\u5b57\u7b26\u957f\u5ea6
\u8bf4\u660e\uff1a\u8fd4\u56de\u4ece\u5b57\u7b26\u4e32\u4e2d\u95f4\u7684\u5b57\u7b26
select SUBSTRING('SqlServer_2014',4,6)
\u7ed3\u679c\uff1aServer<\/p>\n
\u4e8c\u3001\u4e3e\u4f8b\u8bf4\u660e\uff1a<\/p>\n
--\u622a\u53d6\u5b57\u7b26\u4e32\u5de6\u8fb95\u4e2a\u5b57\u7b26--\nselect 'Hello World!',LEFT('Hello World!',5) as \u5de6\u8fb95\u4e2a\u5b57\u7b26\n--\u622a\u53d6\u5b57\u7b26\u4e32\u53f3\u8fb96\u4e2a\u5b57\u7b26--\nselect 'Hello World!',RIGHT('Hello World!',6) as \u53f3\u8fb96\u4e2a\u5b57\u7b26\n--\u622a\u53d6\u5b57\u7b26\u4e32\u4e2d\u95f48\u4e2a\u5b57\u7b26\uff08\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4ece\u54ea\u4e2a\u5b57\u7b26\u4e0b\u6807\u5f00\u59cb\uff09\nselect 'Hello World!',SUBSTRING('Hello World!',3,8) as \u4e2d\u95f48\u4e2a\u5b57\u7b26<\/code><\/pre>\n\u7ed3\u679c\u5982\u4e0b\u56fe\uff1a<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e00\u3001sqlserver\u63d0\u4f9b\u4e86\u4e09\u79cd\u5e38\u7528\u622a\u53d6\u5b57\u7b26\u4e32\u65b9\u6cd5\uff0cLEFT()\u3001RIGHT()\u3001SUBSTRING()1\u3001LEFT()\u51fd\u6570\u8bed\u6cd5\uff1aLEFT(character,integer)\u6ce8\u91ca...","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\/360"}],"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=360"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/360\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}