Error creating database table using FirebirdSQL - sql

I'm trying to add tables to a FirebirdSQL database using FlameRobin but I'm getting the following error:
Error: *** IBPP::SQLException ***
Context: Statement::Prepare( CREATE TABLE drinks
(
...
) )
Message: isc_dsql_prepare failed
SQL Message : -104
can't format message 13:896 -- message file C:\Windows\firebird.msg not found
Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 3, column 5
.
I've tried googling the problem but have been unable to find a solution. Does anyone know what the issue is here?

As it stands it looks like the CREATE TABLE in the question is the actual statement. In that case you are getting the error because it is simply invalid syntax:
CREATE TABLE drinks (
...
)
If I execute this in Flamerobin, I get almost the same error (except for me at line 2, column 5 (the first .), as the parser expects a column name there. At the ... you need to specify the actual columns (and optionally constraints) of the table.
For example:
CREATE TABLE drinks (
ID INTEGER PRIMARY KEY,
NAME VARCHAR(100) NOT NULL
)

Related

How do I change column data type in Redshift?

I have tried changing the column data type in Redshift via SQL. Keep getting an error:
[Amazon][Amazon Redshift] (30) Error occurred while trying to execute a query: [SQLState 42601] ERROR: syntax error at or near "TABLE" LINE 17: ALTER TABLE bmd_disruption_fv ^
Unable to connect to the Amazon Redshift server 'eceim.master.datamart.eceim.sin.auto.prod.c0.sq.com.sg'. Check that the server is running and that you have access privileges to the requested database
The first sql query works. I have tried writing the Alter Table script before the Select lines but it did not work too.
`
*Extract selected columns and renaming them for easier reference
*/
select ID, Completion_Time AS Date_Reported, Name2 AS Name, Contact_Info_for_updates AS Contact_Info,
Your_operation_line AS Operation_Line, Aircraft_Registration_SMU_SMT_etc AS Aircraft_Reg,
Designation_trade_B1_B2_ACT_AST_AAT AS Trade, Choose_your_Issue AS Issue, Manpower, Material, Equipment_GES,
Information, Tools, State_details_here_SVO_number_too AS Issue_Details, Time_wasted_on_due_to_issue AS Time_Wasted,
State_additional_comments_suggestions AS Additional_Comments, Stakeholders, Status
from bmdm.bmd_disruption_fv
/*Change colum data type
*/
ALTER TABLE bmd_disruption_fv
{
ALTER COLUMN ID TYPE INT
}
`
Several things are causing issues here. First the curly brackets '{}' should not be in the alter table statement. Like this:
alter table event alter column eventname type varchar(300);
Second, and likely more importantly, you can only change the length of varchar columns. So changing a column type to INT is not possible. You will need to perform a multistep process to make this change to the table.

Moving a table from one schema to another in Exasol

I am trying to move a table which resides in a certain schema to a different schema with the same table name. I have tried the following but they do not work:
rename <OLD_SCHEMA_NAME>.<TABLE_NAME> TO <NEW_SCHEMA_NAME>.<TABLE_NAME>;
The error that appears is:
SQL Error [42000]: invalid identifier chain for new name [line 1, column 100] (Session: 1722923178259251200)
and
ALTER TABLE <OLD_SCHEMA_NAME>.<TABLE_NAME> RENAME <NEW_SCHEMA_NAME>.<TABLE_NAME>;
The error that appears is:
SQL Error [42000]: syntax error, unexpected IDENTIFIER_PART_, expecting COLUMN_ or CONSTRAINT_ [line 1, column 62] (Session: 1722923178259251200)
Many Thanks!
According to Exasol documentation there is no way to move table between schemas using RENAME statement:
Schema objects cannot be shifted to another schema with the RENAME
statement. For example, 'RENAME TABLE s1.t1 TO s2.t2' is not allowed.
I would move the table this way:
create table <NEW_SCHEMA_NAME>.<TABLE_NAME>
like <OLD_SCHEMA_NAME>.<TABLE_NAME>
including defaults
including identity
including comments;
insert into <NEW_SCHEMA_NAME>.<TABLE_NAME>
select *
from <OLD_SCHEMA_NAME>.<TABLE_NAME>;
drop table <OLD_SCHEMA_NAME>.<TABLE_NAME>;

Execution from the statement select * into return error

Can somebody help me?
I am try execute the command below in Oracle 11 and I get this error:
SQL Error [905] [42000]: ORA-00905: keyword not found.
Code:
SELECT *
INTO SAJ.ETMP_TESTE
FROM SAJ.ESAJOBJETO O
WHERE CDOBJETO = 'P800000000J03'
I read the Oracle docs and haven't found any obvious error in my statement.
https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/selectinto_statement.htm
My objective is to create the table ETMP_TESTE with structure from ESAJOBJETO.
I checked user permission and user has permission to action.
You need create table and not select into for create a table based on the result of a query
CREATE TABLE SAJ.ETMP_TESTE
AS SELECT *
FROM SAJ.ESAJOBJETO O
WHERE CDOBJETO = 'P800000000J03'
This will create an empty table named ETMP_TESTE, with the structure of the SAJ.EASJOBJETO table.
CREATE TABLE ETMP_TESTE AS
SELECT *
FROM SAJ.EASJOBJETO
WHERE 1 = 0;
This does not handle contraints and primary keys and things like that, but it will get you the table structure. The 1 = 0 makes sure no data is copied.
If you need primary keys and the like, look into extracting the DDL for EASJOBJETO. Most SQL IDEs have that functionality built in. You can edit it to correct the table name and run the script and get everything.

Teradata "Period" data type triggering error

I just downloaded the TDExpress VM, and when I try to create tables with a column that has a period data type (for example period(date)), I get an error that says "an index is not supported by the period column"...however according to
this link it is supported, and the correct syntax.
I get the same error if i include the precision or not (in the case of period(time)).
edit : DDL-
CREATE TABLE test (
value1 int null,
timePer period(date) null
);

Query returned non-zero code: 10, cause: FAILED

all
when I use the Hive to select the id from a table there are some errors occurring as follows:
Query returned non-zero code: 10, cause: FAILED : Error in semantic analysis: Line 1:68 Invalid table alias or column reference 'Goldman'
can any body give me some questions?
Your error seems to indicate that you are doing a select for a column named Goldman that does not exist. You attempting to do an HQL query for a column goldman or you are attempting to do a query for rows in which a specific column has Goldman.