Subject | RE: [firebird-support] SQL error |
---|---|
Author | Martin Dew |
Post date | 2006-05-09T08:41:47Z |
Check your RefreshSQL statement, it probably has a statement from when
you copied the object to make this new one.. Done this many times before
;-)
Martin Dew
Senior Developer
Adastra Software Ltd.
Unit 4, Eurogate Business Park, Ashford, Kent TN24 8SB
Tel: (01233) 722840 Fax: (01233) 722701
Mobile: 07970 186162 www.adastra.co.uk <http://www.adastra.co.uk/>
________________________________
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of ian
Sent: 09 May 2006 09:40
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] SQL error
Hi,
This is a sql string formation error in Delphi, not a Firebird issue.
umarko4life wrote:
1.
The statement 'where adj.ADJ_DATE = ws_bdr_date ' is telling it to
match two columns adj.ADJ_DATE and ws_bdr_date, although the latter is a
variable, not a column, so it correctly gives an error.
Your string should look more like one of these:
'where adj.ADJ_DATE = ' + DateToStr(ws_bdr_date) +
which will insert the date value as a string
or
'where adj.ADJ_DATE = ' + QuotedStr(FormatDateTime('MM/DD/YYYY',
ws_bdr_date)) +
which will format the date first. Which you use depends on the format in
which you store your dates in the database.
If in doubt, read the Delphi help on datetime routines and SQL.
2.
You can only have one "where". Replace your second and any subsequent
"where"s with "and".
regards
ian
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical support
<http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+supp
ort&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w
4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Micro
soft+technical+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw>
Computer technical support
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Techn
ical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+
support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support
&w6=Microsoft+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA>
Compaq computer technical support
<http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w
1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+tec
hnical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+
support&w6=Microsoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjE
qA6g>
Compaq technical support
<http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technic
al+support&w2=Computer+technical+support&w3=Compaq+computer+technical+su
pport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w
6=Microsoft+technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w>
Hewlett packard technical support
<http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w
1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+tec
hnical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+
support&w6=Microsoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfm
vLcA>
Microsoft technical support
<http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Tech
nical+support&w2=Computer+technical+support&w3=Compaq+computer+technical
+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+suppor
t&w6=Microsoft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw>
________________________________
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
Service <http://docs.yahoo.com/info/terms/> .
________________________________
[Non-text portions of this message have been removed]
you copied the object to make this new one.. Done this many times before
;-)
Martin Dew
Senior Developer
Adastra Software Ltd.
Unit 4, Eurogate Business Park, Ashford, Kent TN24 8SB
Tel: (01233) 722840 Fax: (01233) 722701
Mobile: 07970 186162 www.adastra.co.uk <http://www.adastra.co.uk/>
________________________________
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of ian
Sent: 09 May 2006 09:40
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] SQL error
Hi,
This is a sql string formation error in Delphi, not a Firebird issue.
umarko4life wrote:
> This statement:-You have two errors here:
> var
> ws_bdr_date : TDateTime
>
> begin
> ws_bdr_date := StrToDate(Edit1.Text);
> with IBQuery1 do
> begin
> Close;
> Sql.Clear;
> Sql.Add ('Select adj.ADJ_NO, adj.SRC_PLU, adj.DEST_PLU, ' +
> 'adj.ADJ_TYPE, adj.QTY, adj.COST, ' +
> 'adj.SELL, adj.DEST_QTY, adj.DEST_COST, adj.DEST_SELL ' +
> 'from adj ' +
> // 'where adj.ADJ_DATE
> = "'FormatDateTime 'mm"/"dd"/"yyyy', ws_bdr_date) + '"' + //
> 'where adj.ADJ_DATE = ws_bdr_date ' +
> 'where adj.ADJ_DATE = ws_bdr_date ' +
> ' and adj.ADJ_SOURCE = ''Stock Adj'' ' +
> 'order by adj.ADJ_NO');
> Open;
> end;
>
> using this statement returns "Dynamic SQL error
> SQL error code -206
> Column unknown WS_BDR_DATE ..."
>
> What should I do?
1.
The statement 'where adj.ADJ_DATE = ws_bdr_date ' is telling it to
match two columns adj.ADJ_DATE and ws_bdr_date, although the latter is a
variable, not a column, so it correctly gives an error.
Your string should look more like one of these:
'where adj.ADJ_DATE = ' + DateToStr(ws_bdr_date) +
which will insert the date value as a string
or
'where adj.ADJ_DATE = ' + QuotedStr(FormatDateTime('MM/DD/YYYY',
ws_bdr_date)) +
which will format the date first. Which you use depends on the format in
which you store your dates in the database.
If in doubt, read the Delphi help on datetime routines and SQL.
2.
You can only have one "where". Replace your second and any subsequent
"where"s with "and".
regards
ian
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SPONSORED LINKS
Technical support
<http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+supp
ort&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w
4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Micro
soft+technical+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw>
Computer technical support
<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Techn
ical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+
support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support
&w6=Microsoft+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA>
Compaq computer technical support
<http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w
1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+tec
hnical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+
support&w6=Microsoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjE
qA6g>
Compaq technical support
<http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technic
al+support&w2=Computer+technical+support&w3=Compaq+computer+technical+su
pport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w
6=Microsoft+technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w>
Hewlett packard technical support
<http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w
1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+tec
hnical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+
support&w6=Microsoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfm
vLcA>
Microsoft technical support
<http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Tech
nical+support&w2=Computer+technical+support&w3=Compaq+computer+technical
+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+suppor
t&w6=Microsoft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw>
________________________________
YAHOO! GROUPS LINKS
* Visit your group "firebird-support
<http://groups.yahoo.com/group/firebird-support> " on the web.
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
>* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .
________________________________
[Non-text portions of this message have been removed]