[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

create a table from db2 command line

Posted on 2006-11-22
5
Medium Priority
?
1,006 Views
Last Modified: 2012-08-13
hi ,

i tried to create a db2 table from command line in my local pc (windows xp) by using the following sql code :
firect i connect to the database: OSCTEST
in prompt of:  the db2=>

i paste the folloing sql code:

CREATE TABLE "TESTMEMBERDBSCHEMA"."TESTMEMBERKEYWPORD"  (
              "ID" INTEGER NOT NULL WITH DEFAULT 1 ,
              "KEYWORDS" VARCHAR(400) ,
              "ADDITIONALKEYWORDS" LONG VARCHAR NOT NULL ,
              "FIRSTNAME" VARCHAR(30) NOT NULL ,
              "MIDNAME" VARCHAR(20) ,
              "LASTNAME" VARCHAR(30) NOT NULL ,
              "TITLE" VARCHAR(150) NOT NULL ,
              "EMAIL" VARCHAR(50) NOT NULL ,
              "PROFILE" VARCHAR(200) )   ;

---------------------------------------------------

then i press the enter key. the result is:
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "(" was found following "."TESTMEMBERKEYWPORD"".
Expected tokens may include:  "END-OF-STATEMENT".  SQLSTATE=42601
db2 =>            "ID" INTEGER NOT NULL WITH DEFAULT 1 ,
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "INTEGER" was found following ""ID" ".  Expected
tokens may include:  "JOIN <joined_table>".  SQLSTATE=42601
db2 =>            "KEYWORDS" VARCHAR(400) , );
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token ""KEYWORDS" VARCHAR" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<values>".
SQLSTATE=42601

-------------------------------------------------------------

can someone help answer why there is error?  

i used almost the same sql code in linux to create the table. there is no error

thanks so much for your reply,

lilyyan



0
Comment
Question by:lilyyan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 400 total points
ID: 17997350

Db2 expects the entire statement on one line.  That makes certain things pretty tough.

Fire up db2 with a different terminator character and you should be fine.  Oh, and leave off the final ';'

> db2 -td#
db2 => {paste the text here}
db2 => #
db2 => quit
db2 => #


Kent
0
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 400 total points
ID: 17997711
hi

you can just run db2 -t and it would work (this would make ; the command terminator instead of new line)
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 17997789

Cool.  Didn't know that.    :~}


0
 

Author Comment

by:lilyyan
ID: 17997945
thanks a lot, both works perfectly ^______^
0
 

Author Comment

by:lilyyan
ID: 17997964
could you please reply my another posting: create a table in db2cc
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question