At 03:51 PM 6/12/2005 +0000, you wrote:
Hi,
I am using the 1.7.1 RC3 and getting a problem using the CAST
statement in my sql. For example trying to execute the following SQL
via the data adapter it gives the error "Metadata update statement is
not allowed by the current database SQL dialect 1" (My dialect is set
to 3 in the connection string which makes this error especially
strange).
SELECT CAST(i.COSTPRICE as Decimal(10,2)) as COSTPRICE FROM ITEM i
WHERE ITEMNO=234451
If i remove the cast it works, Does anyone know what is causing this?
Upon further investigation of the problem i looks like this is being
caused by the Decimal(10,2) part of the statement and not the CAST, i have
tried using Numeric instead but this generates the same error. I assume
this is because the dialect is set to 1 and these are features only usable
in dialect 3, but i cannot understand why they work on this database in IB
Admin or IB Manager.
I think you will find that the real error is because of your inconsistent
identifier syntax, and that you have the wrong message file.
These are the full details of the error reported:
SQLCode -817
Isccode 335544793 Symbol ddl_not_allowed_by_db_sql_dial
Metadata update statement is not allowed by the current database SQL dialect %d
This error would be a response to an attempt to *define* something with an
attribute that isn't supported by the SQL dialect. Your statement is not DDL.
You *should* be getting a DSQL error because of either inconsistent
qualifier syntax (missing qualifier in the WHERE clause) and/or invalid
data type in the cast (if the database is dialect 1). Another possibility
is that the real error is a 335544321 | arith_except because you are trying
to cast a single precision (FLOAT) or integer value to a higher precision
number.
Check the versions of any firebird.msg or interbase.msg files in your
server's and client's searchpaths. The version of the message file, the
client and server must all be the same for the message decoding to work
correctly.
Assuming you do have a dialect 3 database (making decimal(10,2) a valid
data type), correct your statement so that it is either fully qualified or
not qualified.
Fully qualified:
SELECT CAST(i.COSTPRICE as Decimal(10,2)) as COSTPRICE FROM ITEM i WHERE
i.ITEMNO=234451
Not qualified:
SELECT CAST(COSTPRICE as Decimal(10,2)) as COSTPRICE FROM ITEM WHERE
ITEMNO=234451
If you want to do a reality check to find out which dialect your database
is, connect to the database using isql with a local connection and do SHOW
SQL DIALECT; Assuming that your Firebird installation was done properly, by
just connecting to the database, the client dialect will be correct for the
server and both (whatever they are) will be the same. I'm not sure that
old versions of third-party tools behave well in this respect.
Helen
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider