Discussion:
Can you create db2 tables/database from valid DB2 DLL Script?
(too old to reply)
c***@us.ibm.com
2007-10-22 13:52:13 UTC
Permalink
Hello everyone.

I have a script file DDL(data definition language) and I was wondering how I can load this into DB2. I have DB2 devlopement tools/DB2 control center.
But I don't see an option to import .DDL's to create a database/tables.

an example of my script is the following:
CREATE DISTINCT TYPE functionType_32767 AS VARCHAR(32767);
CREATE TABLE "MSM".
"bridgeLink"
(
"ActivateCommandText" CharVar_32767
,
"AggregationParent" ObjectLinkList
..
..


Any help would be great! I'm new to DB2 in general.
Mark A
2007-10-22 14:14:07 UTC
Permalink
Post by c***@us.ibm.com
Hello everyone.
I have a script file DDL(data definition language) and I was wondering how
I can load this into DB2. I have DB2 devlopement tools/DB2 control
center.
But I don't see an option to import .DDL's to create a database/tables.
CREATE DISTINCT TYPE functionType_32767 AS VARCHAR(32767);
CREATE TABLE "MSM".
"bridgeLink"
(
"ActivateCommandText" CharVar_32767
,
"AggregationParent" ObjectLinkList
Any help would be great! I'm new to DB2 in general.
Open Control Center.

Tools>>>Command Editor.
c***@us.ibm.com
2007-10-22 14:27:42 UTC
Permalink
Ahh thanks so much that worked!

I created a New test database in the Control Center, I then go to Command Editor and Load in my .DDL file.

I'm having a weird problem though, RSA doesn't complain about this but DB2 doesn't seem to like it.

Its saying the following:
CREATE DISTINCT TYPE AnonymousVar_32767 AS VARCHAR(32767)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0604N The length, precision, or scale attribute for column, distinct type,
structured type, attribute of structured type, function, or type mapping
"VARCHAR(32767)" is not valid. SQLSTATE=42611


Does DB2 not support this format?

Thanks again.
Knut Stolze
2007-10-22 14:33:10 UTC
Permalink
Post by c***@us.ibm.com
Ahh thanks so much that worked!
I created a New test database in the Control Center, I then go to Command
Editor and Load in my .DDL file.
I'm having a weird problem though, RSA doesn't complain about this but DB2
doesn't seem to like it.
CREATE DISTINCT TYPE AnonymousVar_32767 AS VARCHAR(32767)
DB21034E The command was processed as an SQL statement because it was not a
SQL0604N The length, precision, or scale attribute for column, distinct
type, structured type, attribute of structured type, function, or type
mapping
"VARCHAR(32767)" is not valid. SQLSTATE=42611
This length is invalid. The SQL Reference says that VARCHARs can be at most
32672 bytes long.
(http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.admin.doc/doc/r0001029.htm)
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
c***@us.ibm.com
2007-10-22 14:50:57 UTC
Permalink
Thanks it seems my script isn't as valid as I once thought. :)

I looked here for the syntax of a create distinct type and I'm not sure what I'm doing wrong now.

Here's my statement:
CREATE DISTINCT TYPE AnonymousVar_32767 AS VARCHAR(200)
CREATE DISTINCT TYPE Anoymous_254 as VARCHAR(254)
..
..
It says:


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 "CREATE DISTINCT TYPE AnonymousVar_32767 AS "
was found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<space>". SQLSTATE=42601


The syntax matches what it says here:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001029.htm



T sknah
--
IBM Intern
c***@us.ibm.com
2007-10-22 15:25:06 UTC
Permalink
Ahh n/m I found it, it seems you have to also append:
WITH COMPARISONS; to make it work.

Thanks for the help guys!

Mark A
2007-10-22 14:33:59 UTC
Permalink
Post by c***@us.ibm.com
Ahh thanks so much that worked!
I created a New test database in the Control Center, I then go to Command
Editor and Load in my .DDL file.
I'm having a weird problem though, RSA doesn't complain about this but DB2
doesn't seem to like it.
CREATE DISTINCT TYPE AnonymousVar_32767 AS VARCHAR(32767)
DB21034E The command was processed as an SQL statement because it was not a
SQL0604N The length, precision, or scale attribute for column, distinct type,
structured type, attribute of structured type, function, or type mapping
"VARCHAR(32767)" is not valid. SQLSTATE=42611
Does DB2 not support this format?
Thanks again.
Please check the SQL limits sections of SQL Reference VOL I, Appendix A. The
max VARCHAR is a little less than 32767.
Blair Kenneth Adamache
2007-10-22 14:19:30 UTC
Permalink
If the SQL is valid syntax, you could try:

db2 -tvf file.DDL

-t = honor ; as a statement termination character
-v = echo results to screen
-f = take the following filename as input

for more info:

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0010410.htm
Post by c***@us.ibm.com
Hello everyone.
I have a script file DDL(data definition language) and I was wondering how I can load this into DB2. I have DB2 devlopement tools/DB2 control center.
But I don't see an option to import .DDL's to create a database/tables.
CREATE DISTINCT TYPE functionType_32767 AS VARCHAR(32767);
CREATE TABLE "MSM".
"bridgeLink"
(
"ActivateCommandText" CharVar_32767
,
"AggregationParent" ObjectLinkList
..
..
Any help would be great! I'm new to DB2 in general.
Continue reading on narkive:
Search results for 'Can you create db2 tables/database from valid DB2 DLL Script?' (Questions and Answers)
5
replies
can i get question answer of asp.net ?
started 2006-10-11 00:02:47 UTC
software
Loading...