473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Control Statements in Command Center

Hi

In SQL Server query analyser, I have the follwoing query

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[TabUser4]') and OBJECTPROPERTY(id, N'IsUserTable')
= 1)
drop table [dbo].[TabUser4]
GO

I was wondering if there is an equivalent way of performing such a
query in db2 command centre without having to write a procedure??

thanks
Lyn
Nov 12 '05 #1
2 4430
Lyn Duong <ly**@tablimited.com.au> wrote:
Hi

In SQL Server query analyser, I have the follwoing query

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[TabUser4]') and OBJECTPROPERTY(id, N'IsUserTable')
= 1)
drop table [dbo].[TabUser4]
GO

I was wondering if there is an equivalent way of performing such a
query in db2 command centre without having to write a procedure??


(1)
DROP TABLE <schema>.<table>
and then ignore the error code that might have been returned in case the
table did not exist
(2)
SELECT COUNT(*)
FROM syscat.tables
WHERE ( tabschema, tabname ) = ( '<schema>', '<table>' ) AND
type = 'T'

If the return is 1 (one), then run the DROP TABLE.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #2
Hi

Thanks but I was actually looking for something more like a compound
dynamic statement to issue in db2 clp or command center but found that
you can use ddl in these statements anyway. Will need to write a
script with error code checking. Thanks anyway

Lyn

Knut Stolze <st****@de.ibm.com> wrote in message news:<bv**********@fsuj29.rz.uni-jena.de>...
Lyn Duong <ly**@tablimited.com.au> wrote:
Hi

In SQL Server query analyser, I have the follwoing query

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[TabUser4]') and OBJECTPROPERTY(id, N'IsUserTable')
= 1)
drop table [dbo].[TabUser4]
GO

I was wondering if there is an equivalent way of performing such a
query in db2 command centre without having to write a procedure??


(1)
DROP TABLE <schema>.<table>
and then ignore the error code that might have been returned in case the
table did not exist
(2)
SELECT COUNT(*)
FROM syscat.tables
WHERE ( tabschema, tabname ) = ( '<schema>', '<table>' ) AND
type = 'T'

If the return is 1 (one), then run the DROP TABLE.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jean-Marc Blaise | last post by:
Dear all, The Control Center (V8.1 FP4 / Windows), gives as output options : <evmGroup> (
0
by: Ingo Kollesch | last post by:
Moin, i will work, remote acces on the server. After the login, I open the control center an when I click on "Database". The System message is "der Befehl DB2Start is noch nicht abgesetzt". When...
4
by: Sean C. | last post by:
Helpful folks, I've just migrated our test server from V7.2 -FP11 to V8.1.3, on WinNT 4.0. Everything went pretty darn smoothly, however I get the following errors when using the Control Center:...
1
by: Sean C. | last post by:
Helpful folks, I have recently migrated our test server, which runs Win NT 4, from V7.2 FP11 to V8.1.3. Just about everything works wondefully, except I am having major problems getting the...
6
by: Franco Lombardo | last post by:
Hi all, I'm running DB2 8.1.5 on Windows 2000 professional SP4. When I try to start Control Center, I see the splash screen for a while, then it closes and nothing else happens. It happens...
2
by: serge | last post by:
Where can I find this when I install v8.2? Thank you
10
by: Andy K | last post by:
Hi again , I've been trying to connect to a distant database with my control center on WinXp . I'm using a personnal edition DB2 v8.1.9.700 for the control center on WinXp. I've setup a...
0
by: nstefi | last post by:
Hi, I have a DB2 client installed on my laptop which is connected to a DB2 server version 7.1 When I open the Control Center, everything runs smoothly for a while, but after a few commands in...
0
by: Yoav | last post by:
Hello, I have been trying to enter SQL statmenbts to DB2 control center command line. I saw that user "Thames" wrote to you: > I have to repost my question for help. > > Yesterday I set up two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.