Hello All
I am Using sql2005
My Doubt is How To Format Numbers in Sql Query Like
Format(NOS,"0000") in vb
ie I have Table Tbl1 Fields Nos1 Datatype int values 1,2,3,4,................1000
When Simple Query Select * From Tbl1 We got Following o/p
1,2,3,4
But I want Out Put Like below
0001,0002,0003 ,------------, 0010,0011,---------,0100,0101,--------,1000
How we Can Format like this in sql Query
Faisal
4 12703
There is no specific funtionality to do it. You can use Convert method to do some date and string formats. Try to know how to use Convert method in Sql Server.
Hello balame
I know convert method (Convert(Nvarchar(20),Nos) Like
But hw we can get specified format above
Any way thanx For Reply
Faisal
There is no specific funtionality to do it. You can use Convert method to do some date and string formats. Try to know how to use Convert method in Sql Server.
Hello
I Got Solution -
-
SELECT REPLICATE('0', 4 - len(Code)) + Convert(nvarchar(20),Code) AS TempCol FROM Students
-
-
Faisal
Hello
I Got Solution -
-
SELECT REPLICATE('0', 4 - len(Code)) + Convert(nvarchar(20),Code) AS TempCol FROM Students
-
-
Faisal
Or simply... - SELECT right(REPLICATE('0',4) + cast(code as varchar(4)),4) as TempCol FROM Students
-
-- CK
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alistair |
last post by:
it's the idiot with his query strings again...."yippeee" I hear aaron shout
this time the problem is with a date format query
I have a query string thus
strSQL = "SELECT * FROM users where...
|
by: renee_ld |
last post by:
In a query I used the function datediff to calculate the number of
minutes between two time periods on a given day. This function returned
the number of minutes as a long integer data type. I...
|
by: Betrock |
last post by:
This is probably very simple, but I just can't see my way thru it.....
Short version: keyed values(numeric)in a lookup table are stored in a
main table. They are displayed as text values - the...
|
by: DD |
last post by:
I have a UnionQry that is run from StatementsI and StatementP.
the Due and Paid colunms are currency and show the $
however when i union the two the currency format has gone.
Any help please...
|
by: Ataru Morooka |
last post by:
Hi, my table has to have a column with the months names (january,
february...).
When I order it by month it is ordered alphabetically and that's not
what I need.
Reading this ng I found someone...
|
by: Macca |
last post by:
Hi,
I have a table which has a date/time field. I am storing them as follows :-
01/01/2005 11:25
01/01/2005 19:44
02/01/2005 05:04
|
by: Jean |
last post by:
Hi,
I have a query that contains the following in the WHERE part of the
query:
WHERE....Format(IIf(nz()<>0,,
IIf(nz()<>0,,
IIf(nz()<>0,,
))),"0.0") AS Körperhöhe,....
|
by: Claus Haslauer |
last post by:
Hi,
I want to create a crosstab query that looks like this
Date | Elevation 1 | Elevation 2 | ...
______________________________________________________________________
Date 1 | xx.y | xx.y...
|
by: Dixie |
last post by:
I am appending some new fields to a table in vba and when I append a number
field with is a byte, it does not inherit any format. I want it to be the
General Number format, but it is blank. I...
|
by: Dhananjay |
last post by:
Hi all ,
I have got problem when i am tring to exportGridview Data into Excel
format.
It is going into text format ,but what i want is if the field is
number/currency then it should go into...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |