Create an external table Informix - sql

I am trying to create an external table in Informix.
create external table test_table(cols varchar(10))
using ( datafiles('C:/sample.txt'), format 'delimited', deluxe);
But it gives me an error :
[Error Code: -26174, SQL State: IX000] Incorrect DATAFILE entry C:/sample.txt.
Can anyone suggest me the right syntax for path entry...
I have also tried.
load from "C:\sample.txt" insert into test_table;
Which gives me a syntax error. Any help is greatly appreciated!!

About the create external table
Did you check the correct syntax at the manual? (here)
At datafiles keyword, you don't use the correct syntax.
This probably will work.
create external table test_table(cols varchar(10))
using ( datafiles('DISK:C:\sample.txt'), format 'delimited', deluxe);
About the load
It isn't a native command from the engine, is a specific command of dbaccess utility.
So, if you aren't using dbaccess, it will not work.
BTW, the syntax of your load is correct...

Related

Amazon Athena - Error Create Iceberg table

I used this as a reference to create a Create statement that creates an Apache Iceberg table in Amazon Athena's Query Editor. Below.
CREATE TABLE iceberg_table (id int, data string, category string)
PARTITIONED BY (category, bucket(16, id))
LOCATION 's3://xxxxxxxx/iceberg_table/'
TBLPROPERTIES (
'table_type' = 'ICEBERG',
'format' = 'parquet',
'write_target_data_file_size_bytes' = '536870912'
)
When I ran this, I got the following error.
Iceberg cannot found the requested entity
Also, when I ran Explain, I got the following message
line 2:1: mismatched input 'PARTITIONED'. Expecting: 'COMMENT', 'WITH', <EOF>
So, I think there is a problem with the Create statement I created.
I checked to see if extra spaces had been removed or if the quotes were incorrect, but could not find the cause.
I would appreciate your help.
Thanks.
The code works fine for me. I'm using Athena with Engine v3, maybe that's the cause?

SQL Oracle developer with hive connection - using of temp tables

We are using hive connection with oracle SQL developer tool.
Is it possible to use temporary tables while querying external tables through sql developer tool?
Tried this , But doesn't work
CREATE PRIVATE TEMPORARY TABLE my_temp_table (
id NUMBER,
description VARCHAR2(20)
);
Error :
SQL Error: [Cloudera]HiveJDBCDriver ERROR processing query/statement. Error Code: 40000, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:7 cannot recognize input near 'CREATE' 'PRIVATE' 'TEMPORARY' in ddl statement:28:27, org.apache.hive.service.cli.operation.Operation:toSQLException:Operation.java:335,
You can't use an Oracle Database syntax against a hadoop/HIVE target, even with the Oracle Big Data Connector.
Here are the CREATE TABLE clauses available to you
https://docs.oracle.com/en/bigdata/big-data-sql/4.0/bdsug/bigsqlref.html#GUID-066A4568-9F95-4305-A1A5-7BC3E5DF35AF
Here are examples for querying your external table
https://docs.oracle.com/en/bigdata/big-data-sql/4.0/bdsug/bigsql.html#GUID-0628EC5B-E013-40DF-A025-908019F4E681

Simple Syntax Error in SQLite: "Error near line 1: near "SQLite"

I am having a great deal of trouble with this seemingly simple issue. I can't seem to get .read to work. Here is the code that I have tried:
Any help would be greatly appreciated!
.open test.sql
This opens a Sqlite3 database (Creating a new one if the file doesn't already exist) and attaches it as the main one in the sqlite3 shell session.
.read test.sql
This attempts to read a text file full of SQL statements and execute them one by one.
A sqlite database is not a text file full of SQL statements, hence the syntax errors when you try to treat it as one.
The correct syntax is:
CREATE TABLE t (x int);
or
CREATE TABLE t (x INTEGER);
Read more about the CREATE statement and data types.

'Syntax error: Expected ")"' in BigQuery

I want to execute the following SQL statement on BigQuery:
create table TMSPCBTDZOP000(
ART_ID VARCHAR(18),
LND_ID VARCHAR(3),
ART__BEZ VARCHAR(60),
ART_ANZ_ID VARCHAR(18))
I got the following error message:
Error: Syntax error: Expected ")" or "," but got "(" at [2:24]
I tried both legacy and standard SQL.
We are currently trying to use BigQuery as a data source for our reporting software (MicroStrategy) and it fails with the error shown above. The same error appears if I directly fire this SQL statement in bq. How can I fix this?
VARCHAR is not a supported data type; see the data types documentation. Use STRING instead:
create table TMSPCBTDZOP000 (
ART_ID STRING,
LND_ID STRING,
ART__BEZ STRING,
ART_ANZ_ID STRING
)
You need to use standard SQL for this, and you probably need to qualify TMSPCBTDZOP000 with the name of the dataset, e.g. dataset.TMSPCBTDZOP000.
I think you are looking something like mentioned in old thread here
Create table SQL syntax in Google Bigquery
I found it useful and this may help you how to create a table in bigquery.
Cheers,

Simple question on a SQL create table

I was actually in process of creating a sample table in my test database when somehow I missed out on proper syntax and came up with this statement for create table -
CREATE TABLE A (id as INT, column1 as nvarchar(10))
and when I tried to execute this statement, I got the error below -
'nvarchar' is not a recognized built-in function name.
Altough, I found that I should not have used "as" in the column declaration and corrected it, I am now curious on why I got this error for only nvarchar and not for INT.
Also why this error instead of a incorrect syntax or something like that.
Thanks in advance.
AS is used to define computed columns. Therefore SQL Server expects an expression here, and this "looks" like a function call.
Computed columns info on MSDN for SQl Server 2005