CREATE FUNCTION [dbo].[f_num_chn] (@num numeric(14,5))RETURNS varchar(100) WITH ENCRYPTIONASBEGIN--版权所有:weihuachao@sina.com DECLARE @n_data VARCHAR(20),@c_data VARCHAR(100),@n_str VARCHAR(10),@i int SET @n_data=RIGHT(SPACE(14)+CAST(CAST(ABS(@num*…
SQLServer中查询的数字列前面补0返回指定长度的字符串: 如: 角本如下: /****** Script for SelectTopNRows command from SSMS ******/ SELECT TOP [ID] ,[SN] ,[Name] FROM [EduDB].[dbo].[TestTab] ',SN) from TestTab; )+CAST(SN AS varchar()),) AS 'SN' from TestTab; )),) as 'sn' from Test…