Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   suche StrtoInt für MySql (https://www.delphipraxis.net/191710-suche-strtoint-fuer-mysql.html)

LeisureSuitLarry 13. Feb 2017 10:32

Datenbank: MySql • Version: 5.7 • Zugriff über: HeidiSQL

suche StrtoInt für MySql
 
Hallo,

etwas Offtoppic:
ich suche eine SQL Funktion die Zahlen aus einem Char-feld in Int umwandelt. Habe in der Onlinedoku leider nichts passendes gefunden.

Danke
Manfred

mkinzler 13. Feb 2017 10:37

AW: suche StrtoInt für MySql
 
SQL-Code:
cast()
?

LeisureSuitLarry 13. Feb 2017 11:06

AW: suche StrtoInt für MySql
 
select cast(Charfield as Int) ... funktioniert leider nicht. Fehlermeldung bei Int).
select Cast('12345' as Int) ebensowenig wie cast('12345', int).

select cast(now() to date) fuktioniert natürlich

stifflersmom 13. Feb 2017 11:22

AW: suche StrtoInt für MySql
 
Na ja, es ist ja auch eher:
cast as SIGNED oder UNSIGNED
je nachdem ob du ein Vorzeichen brauchst, oder nicht.

LeisureSuitLarry 13. Feb 2017 11:41

AW: suche StrtoInt für MySql
 
Im Feld 'Nummer' ist ein Key als Char gespeichert. jetzt brächtete ich ihn wieder als Int

fillibuster 13. Feb 2017 11:44

AW: suche StrtoInt für MySql
 
Hallo,

geht das nicht mit Convert?

Code:
CONVERT('123',UNSIGNED INTEGER)

hoika 13. Feb 2017 11:46

AW: suche StrtoInt für MySql
 
Hallo,
https://dev.mysql.com/doc/refman/5.7...functions.html

ziemlich weit unten
bei unsigned

LeisureSuitLarry 13. Feb 2017 12:10

AW: suche StrtoInt für MySql
 
mit unsigned funktionierts... vor lauter Wald den Baum nicht gesehen :?

Danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz