See the following example.
db2 =create table aaa (c1 decimal(10,3));
DB20000I The SQL command completed successfully.
db2 =insert into aaa values (200.03);
DB20000I The SQL command completed successfully.
db2 =select * from aaa;
C1
------------
200.030
1 record(s) selected.
db2 =select char(c1) from aaa;
1
------------
0000200.030
1 record(s) selected.
The result is not what I want. I want to the result to be 200.03 as
CHAR type. How can I do this convert?
Thanks in advance.
James 3 4271
James wrote:
db2 =select char(c1) from aaa;
1
------------
0000200.030
The result is not what I want. I want to the result to be 200.03 as CHAR type. How can I do this convert?
Maybe there are the better ways, but, if nothing else, you can write UDF in C language, and make any sofisticated 'printf' formatting...
--
Konstantin Andreev.
James wrote:
See the following example.
db2 =create table aaa (c1 decimal(10,3));
DB20000I The SQL command completed successfully.
db2 =insert into aaa values (200.03);
DB20000I The SQL command completed successfully.
db2 =select * from aaa;
C1
------------
200.030
1 record(s) selected.
db2 =select char(c1) from aaa;
1
------------
0000200.030
1 record(s) selected.
The result is not what I want. I want to the result to be 200.03 as
CHAR type. How can I do this convert?
Check if STRIP is available on your system.
Also check TRIM which is very similar on new DB2's http://publib.boulder.ibm.com/infoce...c/r0023197.htm
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
On Jun 2, 8:11 pm, Serge Rielau <srie...@ca.ibm .comwrote:
James wrote:
See the following example.
db2 =create table aaa (c1 decimal(10,3));
DB20000I The SQL command completed successfully.
db2 =insert into aaa values (200.03);
DB20000I The SQL command completed successfully.
db2 =select * from aaa;
C1
------------
200.030
1 record(s) selected.
db2 =select char(c1) from aaa;
1
------------
0000200.030
1 record(s) selected.
The result is not what I want. I want to the result to be 200.03 as
CHAR type. How can I do this convert?
Check if STRIP is available on your system.
Also check TRIM which is very similar on new DB2'shttp://publib.boulder. ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2....
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab- Hide quoted text -
- Show quoted text -
It may be depend on client program whether leading and trailing ZEROs
are displayed.
But, wheather client program returns what format, if you are using DB2
9, you can use strip function to get the format you want.
Like this:
STRIP(CHAR(200. 03), B, '0')
Otherwise, you can use LTRIM and RTRIM instead of STRIP functin.
TRANSLATE(RTRIM (LTRIM(TRANSLAT E(CHAR(200.03), ' ', '0'))),'0',' ') This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: Du |
last post by:
I'm trying to automate the upload process to yousendit.com, but the file
size doesn't add up and yousendit.com keep rejecting my upload (it accepts
the upload until the very end)
I don't know what i'm missing, I use Fiddler and I got my header and body to
a very close match, but the content-length is slightly off and I got no clue
why
Sorry for the lengthy post, but i have no other way of showing my work
|
by: Asaf Ganot |
last post by:
Hi,
I'm looking for a way to retrieve the date type of a registry value using
c#.
Since I couldn't find a way to do it with 'Microsoft.Win32', I tried to use
the good old API call 'RegEnumValue' which gives you the data type as well
as other things...
After many tries, I managed to call the function without any errors.
However, I get the data type, but not the value's name! (I even get the name
length, but the string that supose to...
|
by: Rod Snyder |
last post by:
I'm trying to set up an asp.net (vb.net) that will allow a user to
insert/update a bio/profile. I wanted to create a SQL Server 2000 table that
includes their contact info and bio info. However, I'm not getting SQL
Server to accept more than about two paragraphs of info. I've tried the
datatypes of ntext and nvar char to no success. I'm presuming most people
will be cutting and pasting from a Word document also.
Does anyone have any...
|
by: Robert Smith jr. |
last post by:
Hello,
Please pardon my newbie question ...
I am building an ASP.NET page that displays a recordset with a Delete
statement enabled (this all works fine). I want to Insert the current
row *that is going to be deleted* into another table, before the
original data is deleted.
I am trying to use the RowDeleting method to call an Update or Insert
| |
by: x |
last post by:
hi
i am a pilot by profession. i want to create a database of my logbook
using ms access 2002. i am facing a problem regarding the format of
time field. when i select "Data/Time" data type for my time field then
this format gives the liberty to record times uptill a figure of 59 in
different sub-formats, whereas i want the format to be able to record
the times like 80:35 or 1:10 or 1138:00. which means that i have these
many hours on a...
|
by: dananrg |
last post by:
I was messing around with the native ODBC module (I am using Python in
a Win32 environment), e.g:
import dbi, odbc
....and it seems to meet my needs. I'd rather use a module that comes
natively with Python if it works (don't care about performance in this
particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an
|
by: neeraj |
last post by:
Hi All
Can any give me the code for convert "DataColumn" data type of
"DataTable". Even if data table already populated (have data)
Actually I am creating one search module which searches the data from
"DataView" using "RowFilter" method. Here I m using like
operator for searching, its work fine for string but if data type of
"Data Column" is Date or Integer then its not working.
Now I m decide I will convert data types of all column...
|
by: =?Utf-8?B?SlA=?= |
last post by:
Explanation:
We have several SP that need to retrieve a single "Default Photo" from one
of several Photo tables. The column in question in these tables is defined as
an IMAGE data type. I currently have a SP that that return the default photo
and other relative information.
Several of my developers want to retrieve only the image column from this
SP. So I thought Id create a function that would execute code very similar to
the SP...
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |