Home > Blockchain >  Create table #name; is throwing a syntax error
Create table #name; is throwing a syntax error

Time:12-22

When I use the following query:

create table #name;

I get the following error:

SQL Error [42601]: ERROR: syntax error at end of input

I am doing this in RedShift DB

I also tried "create temporary table #name;" and "create temporary table name;". I am getting the same error for this query also.

I am trying to create a temporary table here, but I keep getting syntax error

CodePudding user response:

use the CREATE TEMPORARY TABLE statement.

CREATE TEMPORARY TABLE #name (
    id INTEGER,
    name VARCHAR(255)
);

https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html

CodePudding user response:

You must provide the table and columns name, as well as the data types that will be used in it. For Eg :

create table #name (
column_name1 data_type1,
column_name2 data_typ2
);
  • Related