Search results
28 mar 2013 · you can use LPAD function of sql. Try this. SELECT LPAD(n, 2, 0); Result 01 02 .... 10 Explanation : The LPAD function Left-pad the string with 3rd parameter( i.e 0 in given example) up to length given in 2nd parameter ( i.e 2 in given example) more example. SELECT LPAD('hello', 10, '*'); Result : *****hello
18 lis 2008 · Users enter "1", "01","4","04". I want to display it always as "01","02","03" format. What is the best way to do it? declare @STR char(2); set @STR = '1'; select right('0' +...
24 lut 2007 · Here are a couple of way to do it: select. M1 = right(1000000+MyNumber,4) , M2 = right('0000'+convert(varchar(20),MyNumber),4) from. (. select MyNumber=1 union all. select 10 union all. select 44...
Explained about how to do proper formatting SQL coding in hindiplease to subscribe my patreon link
25 lut 2015 · Here are some basic rules which you may want to keep in mind. While storing Unicode data, the column must be of Unicode data type (nchar, nvarchar, ntext). Another rule is that the value must be prefixed with N while insertion.
25 sty 2010 · SELECT Number=1 UNION ALL SELECT Number=Number+1 FROM Numbers WHERE Number<30000) SELECT REPLACE(STR(Number, @Length), ' ', '0'), Substring(@Zeros,1,@Length-Len(Number)) + CAST(Number as varchar(20)) FROM Numbers: OPTION(MAXRECURSION 0)
1 gru 2018 · The FORMAT () function formats a value with the specified format (and an optional culture in SQL Server 2017). Use the FORMAT () function to format date/time values and number values. For general data type conversions, use CAST () or CONVERT ().