|
Log in |
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]() Hi I have the following Prepared SQL:
Insert into test (Date1) values(:?); How do I assign NULL to Date1 ? Regards, M. Said |
#2
|
|||
|
|||
![]() "M. Said" <muneers@xmail.com> wrote in message news:3f79c4e4@wic040d.... > Hi I have the following Prepared SQL: > > Insert into test (Date1) values(:?); > > How do I assign NULL to Date1 ? > > Regards, > > M. Said Try using the string "NULL" Des |
#3
|
|||
|
|||
![]() I tried the following:
Q.Params[0].AsString := 'NULL'; or Q.Params[0].AsDateTime := NUL; Does not work. Is this the correct syntax? Also, I tried to use a TnxTable with the following: TestTable.FieldByName('DATE1').AsString := 'NULL'; Does Not Work. Is this the correct syntax? What I am trying to do is assign a NULL value to a DateTime Field while importing some records from a text file. Regards, M. Said "Des O'Toole" <des@t-and-h.demon.no-spam.co.uk> wrote in message news:3f79cd69@wic040d.... > > "M. Said" <muneers@xmail.com> wrote in message news:3f79c4e4@wic040d.... > > Hi I have the following Prepared SQL: > > > > Insert into test (Date1) values(:?); > > > > How do I assign NULL to Date1 ? > > > > Regards, > > > > M. Said > > > Try using the string "NULL" > > Des > > > |
#4
|
|||
|
|||
![]() << Q.Params[0].AsString := 'NULL';
or Q.Params[0].AsDateTime := NUL; Does not work. Is this the correct syntax? >> Try: Q.Params[0].Clear; << TestTable.FieldByName('DATE1').AsString := 'NULL'; Does Not Work. Is this the correct syntax? >> TestTable.FieldByName('DATE1').Clear; In SQL you'd assign NULL: insert into TestTable (DATE1) values(null); Ole Willy Tuv |
#5
|
|||
|
|||
![]() Thanks for the timely response.
When I try: Q.Params[0].Clear; I get the following exception: Invalid date/time format [no error code] Also, Where is NUL defined? Regards, M. Said "Ole Willy Tuv" <owtuv@online.no> wrote in message news:3f79dba2@wic040d.... > << Q.Params[0].AsString := 'NULL'; > or > Q.Params[0].AsDateTime := NUL; > > Does not work. Is this the correct syntax? >> > > Try: > > Q.Params[0].Clear; > > << TestTable.FieldByName('DATE1').AsString := 'NULL'; > Does Not Work. Is this the correct syntax? >> > > TestTable.FieldByName('DATE1').Clear; > > In SQL you'd assign NULL: > > insert into TestTable (DATE1) values(null); > > Ole Willy Tuv > > |
#6
|
|||
|
|||
![]() << When I try:
Q.Params[0].Clear; I get the following exception: Invalid date/time format [no error code] >> As a last shot, try: Q.Params[0].Value := Null; If you get the same error, I'm out of ideas ;-) << Also, Where is NUL defined? >> NULL (not NUL) is defined in Variants.pas (D6/D7) or System.pas (D5). Ole Willy Tuv |
#7
|
|||
|
|||
![]() Param[0].Clear;
Param[0].Value := Null; Param[0].DataType := TFieldType.ftDate; This works when you want to set a date parameter to a null value in an UPDATE query |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I define a not null Charater (NullString) Field | Matthew Balraj | nexusdb.public.support.adoprovider | 1 | 12th February 2010 02:05 AM |
PreAnn: v3 being prepared | Eivind Bakkestuen [NDD] | nexusdb.public.announcements | 0 | 29th May 2009 03:33 PM |
SQL Statement for DateTime Field | Carsten Groh | nexusdb.public.support.php | 2 | 28th April 2009 12:46 AM |
Sum, Coalesce and Null fields | Brenton Wildman | nexusdb.public.support.adoprovider | 1 | 19th January 2006 07:51 AM |
Prepared/Unprepared queries | Ole Willy Tuv | nexusdb.public.support.adoprovider | 3 | 18th February 2004 02:00 PM |