-
sql variable definieren bzw. runden
hallo Leute,
wie kann ich variable "var_x" so definieren bzw. runden,
dass im sql-Ergebnis nur max. 2 Dezimalstellen angezeigt werden:
select datei_1.var_1, datei_1.var_2,
var_1/var_2 as var_x
from...
Vielen Dank
-
Code:
>>-ROUND--(--expression-1--,--expression-2--)------------------><
expression–1
An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is converted to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE.
expression–2
The argument must be an expression that returns a value of a built-in BIGINT, INTEGER, or SMALLINT data type.
If expression–2 is positive, expression–1 is rounded to the expression–2 number of places to the right of the decimal point.
If expression–2 is negative, expression–1 is rounded to 1 + (the absolute value of expression–2) number of places to the left of the decimal point. If the absolute value of expression–2 is greater than the number of digits to the left of the decimal point, the result is 0. (For example, ROUND(748.58,-4) returns 0.)
Quelle: SQL Reference
In deinem Fall:
Code:
select datei_1.var_1, datei_1.var_2,
ROUND(var_1/var_2, 2) as var_x
from...
-
hallo Woki,
klappt vorzüglich.
Vielen Dank
Similar Threads
-
By GraueEminenz in forum NEWSboard Programmierung
Antworten: 1
Letzter Beitrag: 10-07-06, 11:58
-
By Rincewind in forum NEWSboard Programmierung
Antworten: 13
Letzter Beitrag: 03-06-05, 10:56
-
By Jenne in forum NEWSboard Programmierung
Antworten: 3
Letzter Beitrag: 23-08-04, 10:45
-
By hs in forum IBM i Hauptforum
Antworten: 5
Letzter Beitrag: 30-01-02, 11:37
-
By infomio in forum IBM i Hauptforum
Antworten: 7
Letzter Beitrag: 27-11-01, 19:31
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks