select right('000'+str(ID),3) from 表
解决方案 »
- 关于两张表的合成 急!!
- 在本地数据库服务器的两个数据库中,如何在一个数据库中访问另外一个
- 使用ado执行简单sql语句,sql2005服务器有时候会失败,错误码说连接断开
- 关于分组查询的sql语句求解
- 大量数据导入问题,BULK INSERT ,或生成若干个'insert into table '问题
- sql server 卸载后不能重装,请问怎么解决?
- 求sql语句 Delete from Application where App_MenuIndex==5 在线等,急,谢谢
- 执行远程存储过程慢的原因
- SqlServer Sleeping 进程越来越多最后超时
- 求解一个求平均值的问题,先谢谢大家了
- 高分请教:能否实现暂停(挂起)和停止一个正在执行的SQL语句
- 如何在a,b,c三张表中查一条记录'1'?他们有相同的字段code
case
when id <10 then '000'+cast( id as char)
when id < 100 then '00'+cast(id as char)
when id < 1000 then '0'+ cast(id as char)
end
from table
------------------------------
转换数据类型
declare @i varchar(10)
set @i = '0012'
select cast(@i as int) --将@i转换为int型select convert(int,@i) --将@i转换为int型