Home > Database > Mysql Tutorial > body text

SQL语句中字符串补位(PLSQL & TSQL)

WBOY
Release: 2016-06-07 17:46:47
Original
1789 people have browsed it
PLSQL:标准函数
Select  Lpad(''1'',10,''0'')  From Table;
1的右边插入10个''0''字符.
Select  Rpad(''1'',10,''0'')  From Table;
1的左边插入10个''0''字符.

TSQL:自己写的

SELECT  
     Replace(space(10-len(Column)),'' '',''0'')+
     Column
From  Table
将Column不足10位的0补齐。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!