[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] if not exists (select * from sysobjects where name='<>') = processing should stop
- Subject: RE: [sqr-users] if not exists (select * from sysobjects where name='<>') = processing should stop
- From: "Bob Buford" <Bob.Buford@ccci.org>
- Date: Wed, 26 Apr 2006 08:54:03 -0400
- Delivery-date: Wed, 26 Apr 2006 08:56:25 -0400
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
- Thread-index: AcZpMH5dbC3FIAAwQSGgmmUk6sZxqA==
- Thread-topic: [sqr-users] if not exists (select * from sysobjects where name='<>') = processing should stop
Hi Jay,
How about doing a select from each of those tables and using the
ON-ERROR flag to trap to an error procedure that will evaluate the
#sql-status and stop if the error is 20004?
The Begin-select must be within either a procedure or the Begin-Program
section
BEGIN-PROGRAM
BEGIN-SELECT ON-ERROR=SQLError
<some column>
FROM TRANSACTION_TABLE
END-SELECT
END-PROGRAM
BEGIN-PROCEDURE SQLError
EVALUATE #SQL-STATUS
when = 20004
PRINT 'Some error message' (1,1)
STOP
END-EVALUATE
END-PROCEDURE
Bob Buford
Team Leader, Donor Applications
IT Group
Campus Crusade for Christ, Int'l.
-----Original Message-----
From: Jay Sagadraca [mailto:knight7883@yahoo.ca]
Sent: Tuesday, April 25, 2006 5:48 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] if not exists (select * from sysobjects where name
='<>') = processing should stop
Hello Gurus,
We have the following :
SunOS 5.9
SQR version 6.2
SYBASE_VERSION=12.5.0
My problem is :
begin-setup
begin-sql on-error=stop
if not exists (select 1 from sysobjects where name =
'Transaction_Table') begin
raiserror 20004 "Table: Transaction_Table do not exist "
end
end-sql
begin-sql
if exists ( select 1 from sysobjects where name = 'Clients')
begin
print "Found the table ..."
end
end-sql
end-setup
Begin-report
End-report
I would like to abruptly stop the processing of the whole sqr if the
table is not on the sysobjects system table. I tried this (above) but
it still goes to the next begin-sql and process it. Is there another
way to do this or another command to force the sqr to totally stop the
processing if it didn't find the table?
Thanks for the help.
Jay Sagadraca
---------------------------------
Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger
with Voice
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users