Board index » cppbuilder » year field

year field


2004-02-19 03:36:49 AM
cppbuilder36
I have a table that was built several years ago that has a field named
Year. Now that I'm starting to use queries, I have discovered that a
field named Year is a bad idea. I would like to add a new field to the
table named BYear using ALTER TABLE. Then with another query, copy the
data from the Year field to the BYear field. Then delete the Year field
using DROP. Here is the code I'm having problems with:
UPDATE 'BR1997' SET BYear = '1997'
WHERE Year = '1997';
How to get around the Year field?
There is another field that has the last two digits of the year in it
called Camp_num. For instance 01-97. I have tried the following code &
it doesn't work either:
UPDATE 'BR1997' SET BYear = '1997';
WHERE SUBSTRING(Camp_num FROM 4 FOR 2) = '97'";
Any ideas?
 
 

Re:year field

Look documentation for your DBMS. For example, for MS DBMS (MS SQL Server,
MS Jet/MS Access) you could enclose field name in brackets: [Year]. For
others quote char could be single quote, double quote, ` - 'Year', "Year",
`Year`.
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Don Locke" < XXXX@XXXXX.COM >???????/???????? ? ????????
?????????: news:4033bed0$ XXXX@XXXXX.COM ...
Quote
I have a table that was built several years ago that has a field named
Year. Now that I'm starting to use queries, I have discovered that a
field named Year is a bad idea. I would like to add a new field to the
table named BYear using ALTER TABLE. Then with another query, copy the
data from the Year field to the BYear field. Then delete the Year field
using DROP. Here is the code I'm having problems with:

UPDATE 'BR1997' SET BYear = '1997'
WHERE Year = '1997';

How to get around the Year field?

There is another field that has the last two digits of the year in it
called Camp_num. For instance 01-97. I have tried the following code &
it doesn't work either:

UPDATE 'BR1997' SET BYear = '1997';
WHERE SUBSTRING(Camp_num FROM 4 FOR 2) = '97'";

Any ideas?

 

Re:year field

I finally found it!! I should have told you that I was using dBase IV
tables that I'm converting over to Advantage. I had also made the
mistake of naming the table 1997BR.dbf. This is what finally worked:
SELECT '1997BR'."YEAR" FROM '1997BR'
Thanks for your help.
Don
 

{smallsort}