AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Mysql Typs (Null) Typ (Integer)

Ein Thema von question · begonnen am 25. Aug 2013 · letzter Beitrag vom 25. Aug 2013
 
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Mysql Typs (Null) Typ (Integer)

  Alt 25. Aug 2013, 19:27
Hello,
I am using Delphi with mysql, i have a table which contains the data.For example
Table A has ID,Name,Phone and so on , the empty field are filled with "Null"
ID=1, Name=To,Phone=null,

I would like to copy the data from Table A to Table B, but the problem is, if there is no value in a filed then its filled with '0' instead of Null and i got a error messege

"Variante des Typs (Null) konnte nicht in Typ (Integer) konvertiert werden."

ID=1,Name=Tom,Phone=0

my question is, why one table put Null and others 0,since both are same field and same type

need suggestion, i wanna filled the emtpy field not with 0 rather Null,how to do it?

Code:
Query.SQL.Clear;
    Query.SQL.Add('SELECT * FROM TableA WHERE ID = :ID');
    Query.ParamByName('ID').AsInteger := NewID;
    Query.Open;

    while (Query.Eof) and (Query.RecordCount > 0) do

   begin
      QueryB.Close;
      QueryB.SQL.Clear;

      QueryB.SQL.Add('INSERT INTO `TableB` (`ParentID`,`NewID`, and so on
     ,.......
      QueryB.ParamByName('ParentID').AsInteger := Query.FieldByName('ParentID').AsInteger;
      QueryB.ParamByName('NewID').AsInteger := NewID;
I would like to fill the empty field with "null" instad of "0" what should i change ?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:46 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