MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CREATE TABLE AS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Tue Jul 15, 2008 4:13 pm    Post subject: CREATE TABLE AS Reply with quote

Could anyone help me sorting my problem of creating a table using the below query.

I am using SPUFI.

Thanks in advance.

CREATE TABLE TABLE02 AS (SELECT * FROM TLCS135);

ERROR:


DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "<END-OF-STATEMENT>". SOME
SYMBOLS THAT MIGHT BE LEGAL ARE: DATA WITH <IDENTIFIER>
DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 502 0 0 -1 47 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'000001F6' X'00000000' X'00000000' X'FFFFFFFF'
X'0000002F' X'00000000' SQL DIAGNOSTIC INFORMATION
Code:

_________________
Satya
Back to top
View user's profile Send private message
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Tue Jul 15, 2008 4:36 pm    Post subject: Reply with quote

Did you check the DB2 Application SQL Manual for proper syntax? What version DB2 are you on? Are you trying to create an MQT? Or are you trying to create another table that is a clone of TLCS135...if so use the LIKE syntax...check the manual to resolve your -104.
_________________
Eric C. Bakke
Senior DB2 DBA
Back to top
View user's profile Send private message
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Tue Jul 15, 2008 4:52 pm    Post subject: CREATE TABLE AS Reply with quote

Thanks Eric for your response.

Eric if I am using

CREATE TABLE <TABLENAME>
LIKE <EXISTING TABLENAME>

I am getting -551 error. (Authorization Error)

At the sametime if i am trying to create a table with the mentioned syntax:

CREATE TABLE <TABLENAME>
AS (SELECT * FROM <EXISTING TABLENAME>

It is showing -104 error.

bonk
_________________
Satya
Back to top
View user's profile Send private message
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Tue Jul 15, 2008 4:57 pm    Post subject: Reply with quote

using the MQT style of creating tables 'WITH NO DATA' clause is required if you only want a table defined in the catalog with no data which means the table isn't really an Materialized Query table. Try adding this phrase at the end of your statment before the semi-colon.

But why would you want to create a table in this fashion without specifying the IN DATABASE clause? Do you really want it to go to the default database (DSNDB04 in most shops)? You really should consider building a stogroup, database, and tablespace to put your new table in instead of having it default unless you're just needing a quick adhoc table.
_________________
Eric C. Bakke
Senior DB2 DBA
Back to top
View user's profile Send private message
Eric.C.Bakke
Beginner


Joined: 14 Jul 2008
Posts: 15
Topics: 0
Location: Plano, TX

PostPosted: Tue Jul 15, 2008 4:59 pm    Post subject: Reply with quote

the -551 is due to you not having authority to select from the table...you'll need someone to grant you access before you can use the 'LIKE' or 'AS' methods.
_________________
Eric C. Bakke
Senior DB2 DBA
Back to top
View user's profile Send private message
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Tue Jul 15, 2008 5:07 pm    Post subject: CREATE TABLE AS Reply with quote

Thanks Eric once again.

I am getting -551 ERROR. I will contact my sysadmin regardin this to grant me the previleges to create a table in Default database..


Thanks a lot for your response..
_________________
Satya
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group