Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Problem defining a default time field.
Fri, Feb 15 2013 1:58 AMPermanent Link

Colin Wood

VirtualTec P/L

Hi All,
I'm having a problem trying to create a table which contains 4 time fields.  I would like to preset the default times but when I use the code below it returns a #700 Error indicating it expected a Null or time expression but instead found '00:00'.  I'm probably missing something obvious but I've been playing around with it for a while now and can't see the problem.
Any help appreciated.
Regards
Colin

       Query1.SQL.Add('Create Table "Prefs"("PatchNumber" SmallInt,');
       Query1.SQL.Add('"BeforeHrsStart"      Time Default ' + Quote('00:00')+ ',');
       Query1.SQL.Add('"BeforeHrsFinish"     Time Default ' + Quote('07:59')+ ',');
       Query1.SQL.Add('"AfterHrsStart"       Time Default ' + Quote('16:00')+ ',');
       Query1.SQL.Add('"AfterHrsFinish"      Time Default ' + Quote('23:59')+ ',');
       Query1.SQL.Add('"UseOutOfHrsMessage"  Boolean Default False,');
       Query1.SQL.Add('"DisplayMessage"  Boolean Default False,');
Fri, Feb 15 2013 4:11 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Colin


ElevateDB uses "proper" times so rather than

"BeforeHrsStart"      Time Default ' + Quote('00:00')+ ',');

you'll need something like

BeforeHrsStart"      Time Default ' + CAST('00:00:00' AS TIME)+ ',');

Roy Lambert [Team Elevate]
Fri, Feb 15 2013 10:04 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Colin,

The correct syntax is:

"BeforeHrsStart" TIME DEFAULT TIME '00:00'


--
Fernando Dias
[Team Elevate]
Fri, Feb 15 2013 10:09 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Colin,

....
Or, in your case:

Query1.SQL.Add('"BeforeHrsStart" Time Default Time ' + QuotedStr('00:00') + ',');

--
Fernando Dias
[Team Elevate]
Sun, Feb 17 2013 2:10 AMPermanent Link

Colin Wood

VirtualTec P/L

Thank you very much gentlemen.
Colin
Image