cnblogs/dcrenl/SQL Server 加前导0(1).html
2024-09-24 12:43:01 +08:00

11 lines
652 B
HTML

<div id="sina_keyword_ad_area2" class="articalContent ">
<div style="font-family: 宋体,Verdana,Arial,Helvetica,sans-serif; line-height: 1.5;">declare @a int</div>
<div style="font-family: 宋体,Verdana,Arial,Helvetica,sans-serif; line-height: 1.5;">declare @b int</div>
<div style="font-family: 宋体,Verdana,Arial,Helvetica,sans-serif; line-height: 1.5;">set @a = 1 --需要显示的数字</div>
<div style="font-family: 宋体,Verdana,Arial,Helvetica,sans-serif; line-height: 1.5;">set @b = 3 --显示位数</div>
select right(cast(power(10,<span style="line-height: 21px;">@b</span>) as varchar)+@a,@b)
<div><br />
</div>
</div>
<p>&nbsp;</p>