[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

How to convert an SQL statement to DB2 syntax

Asked by atorex in DB2 Database

I have a large database that I need to drop and recreate Indexes, the client used SQL 2005 so I created a script to do this. They have now moved on to DB2 but I still need to re Index the tables.
here is an example that I would like to get converted to DB2 syntax, all tables and Indexes are the same in both databases. The alter statement I would guess to be the same the one I dont know is the ( IF EXISTS) statement, will it work in DB2

 
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[myco].[AccessSets]') AND name = N'PK_AccessSets')
ALTER TABLE [myco].[AccessSets] DROP CONSTRAINT [PK_AccessSets]

ALTER TABLE [myco].[AccessSets] ADD  CONSTRAINT [PK_AccessSets] PRIMARY KEY CLUSTERED (      [ID] ASC )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
 
Related Solutions
Keywords: How to convert an SQL statement to D…
 
Loading Advertisement...
 
[+][-]11/03/09 02:46 PM, ID: 25734723Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 10:28 PM, ID: 25736901Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 06:05 AM, ID: 25759158Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 11:03 AM, ID: 25762006Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625