In IBM SQL Query, simple table creation query is not working, its give error -
No viable alternative at input 'CREATE TABLE'
I take query(for create table) from official site and its also give the same error.
Attached below (official site query) screenshot url
https://i.ibb.co/n78BrPd/officalsiteexample.png
The IBM SQL Query service allows you to run queries (SELECT statements) against data. The syntax reference only has SELECT, not CREATE TABLE. Thus, seeing the syntax error is expected.
Related
I am trying to create and view tables in AWS Athena from S3 using SQL queries.
Here is the sequence
CREATE DATABASE testaccesspoint
CREATE EXTERNAL TABLE IF NOT EXISTS `testaccesspoint`......
show tables
The above queries ran successfully and created the database, so I don't feel there is any need to put the complete queries here for this.
Now I am trying to view the table using the query
SELECT * FROM "testaccesspoint"."mybucket" limit 10;
Here is the error I am getting:
[ErrorCode: INTERNAL_ERROR_QUERY_ENGINE] Amazon Athena experienced an internal error while executing this query. Please contact AWS support for further assistance. You will not be charged for this query. We apologize for the inconvenience.
This query ran against the "testaccesspoint" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 024fca79-447d-421f-ac6d-7b283de12adf
I have tables in Azure Databricks that I am using SQL to interact with via a notebook. I need to select all columns from a table with 200 columns, I need to select all of them but I need to modify some for a select insert (To modify specific columns for a PK). Therefore I can not use a select *. (There are multiple scenarios this is just my current objective)
How can I generate a select statement on a table with all the column names in a sql statement. This would be equivalent of a 'Select top N' in SSMS where it generates a select for the table I can than edit.
I have seen functions like describe and show but they can't build a select statement.
I am new to Databricks. Any help is appreciated.
I have the same problem. It is really tough to make and modify SELECT statement for this kind of tables. I have tried many ways and found using the 3rd party software to connect to the table on Azure Databricks worked fine.
Here is what I do:
Download the 3rd party software such as DBeaver
Download Databricks JDBC driver form this page.
Configure Databricks driver. Luckily there is an official doc for DBeaver.
Connect to the Databricks and find the table to generate SELECT statement.
Use DBeaver built-in function to generate it. See the screenshot below.
That's it!
I found this setup took just 10-15 minutes to complete saving much time.
My procedure has large query syntax, many "nested if else" when I create it on one SQL Server I get this error:
Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.
but when I create that on another server, it is created without error. I know the procedure has poor performance but why that is created correctly on another server
Does it depend on server config or database feature ?
when i create that on another server,that is created without error
Reason is that the two version is not same . I think you 1st server is older than 2012sp1 that's why you got that error. you can check this link
I'm using Oracle PL/SQL developer. I have two databases live and dummy.
I have been using the dummy database for development and now i need to add all the new tables and data into the live database without effecting the data currently stored in it.
I also need to copy over all the new sequences and triggers.
I've tried exporting a table but had no luck and using the SQL view i only get the SQL for the creation of the data and not the data it contains.
I also found this SQL code
COPY FROM test#DUMMY - CREATE test -USING SELECT * FROM test;
But it asks me for a name and password of which I dont know and then fails after 3 attempts. It then goes on to say there is a syntax error as well.
I'm still fairly new to using Oracle and any help would be appreciated.
You can do that using datapump.
or if you want to copy from schema to schema
create table shecma2.old_table
as
select * from schema1.old_table
or using oracle sql developer - here is link.
Try:
CREATE TABLE NEWTABLE AS SELECT * FROM OLDTABLE;
Is there a way to parse code in SQL Developer (oracle) without actually touching tables/packages data like you can do with "parse" option in SQL Management studio?
There is no option to merely parse the SQL statement to validate the syntax.
You could choose the "Explain Plan" option (F10 in the Windows version of SQL Developer), that will validate the syntax as part of generating the query plan. If there is a syntax error, you'll get the error message when you attempt to generate the plan but you generally won't get the line and column of the error which makes debugging more challenging.
I was looking for this right now and couldn't find an option in Oracle SQL Developer.
I know a service called SQL Fiddle that can help in such situations where one needs to test/parse/validate an adhoc PL/SQL script. Using SQL Fiddle you can do this:
Select Oracle 11g R2 (as available right now) in the dropdown and type your script in the left text area. Press Build Schema button. If your script is valid then it'll show you Schema Ready message like this: