--- tags: SQL author: Anderson --- # MSSQL字串左右補零 ###### tags: `SQL` ## :memo:Code ```sql= Select RIGHT(REPLICATE('0', 8) + CAST('12345' as NVARCHAR), 8) as '左邊補零' , LEFT(CAST('12345' as NVARCHAR) + REPLICATE('0', 8), 8) as '右邊補零' ``` ## :memo:結果 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up