Home  >  Article  >  Database  >  SQL语句中字符串补位(PLSQL & TSQL)

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

WBOY
WBOYOriginal
2016-06-07 17:46:471827browse
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补齐。
Statement:
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