IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQL To Db2 conversion


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praveenedward_2009

New User


Joined: 26 Aug 2009
Posts: 21
Location: Chennai

PostPosted: Fri Mar 26, 2010 1:03 pm
Reply with quote

Hi,

The below mentioned commands are for Sql server 2005.

Code:
CREATE TABLE [dbo].[ADDRESS](
[ADDR-WHO] [varchar](18) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ADDRTYPE-WHO] [varchar](22) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ADDRESS1] [varchar](36) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
PRIMARY KEY CLUSTERED
(
 [ADDR-WHO] ASC,
 [ADDRTYPE-WHO] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]



I need to create equivalanet statement in Db2 , i checked for the syntac for Primary Key clustered but not sure the equivalant of COLLATE SQL_Latin1_General_CP1_CI to be given in Db2.

Thanks.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 26, 2010 7:28 pm
Reply with quote

Hello,

COLLATE SQL_Latin1_General_CP1_CI - do all of your tables have this specification?

If yes, try leaving it out and see what happens.
Back to top
View user's profile Send private message
praveenedward_2009

New User


Joined: 26 Aug 2009
Posts: 21
Location: Chennai

PostPosted: Fri Mar 26, 2010 8:18 pm
Reply with quote

Hi ,

Yes I do have " COLLATE SQL_Latin1_General_CP1_CI " in all of the tables , let me try out leaving it and creating those tables in Db2.

Thanks for the response will revert you back on the same.
Back to top
View user's profile Send private message
praveenedward_2009

New User


Joined: 26 Aug 2009
Posts: 21
Location: Chennai

PostPosted: Fri Mar 26, 2010 9:09 pm
Reply with quote

I Did try out creating the tables need to check for the keyword " PRIMARY KEY CLUSTERED "

(
[ACCT-ID#] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


My answer - Primary key needs to be defined on Db2 on the field ( ACCT_ID ) .. CLUSTERED - Means whenever we create a primary key it creates a default unique index which will be clustered in this case becuase the primary key is the ideal column for a clustered index.

So we need to create a clustered index with the primary key on Db2.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 26, 2010 9:58 pm
Reply with quote

Hello,

Keep in mind that not every table needs to be clustered. . .

Suggest there be some review of the documentation and then discussion. At the top of the page is a link to "IBM Manuals" and there are several publications for multiple versions of db2.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts SMF Record Date conversion failing CLIST & REXX 1
No new posts Assembler class assignment: stuck on ... PL/I & Assembler 12
Search our Forums:

Back to Top