dbTalk Databases Forums  

Using table_name from systable

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Using table_name from systable in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill McHugh
 
Posts: n/a

Default Using table_name from systable - 12-04-2003 , 03:18 PM






I want to grant privileges on all the user tables in systable, but the
following gives ASA Error -141 "Table 'tbl' not found". Could someone explain
how to do this? TIA.

FOR csr AS curs CURSOR FOR
(SELECT table_name AS tbl
FROM systable
WHERE creator = 101)
DO
REVOKE ALL on tbl from AUser;
GRANT ALL on tbl to AUser WITH GRANT OPTION;
END FOR;



Reply With Quote
  #2  
Old   
Chris Keating \(iAnywhere Solutions\)
 
Posts: n/a

Default Re: Using table_name from systable - 12-04-2003 , 03:52 PM






Build the REVOKE/GRANT statement as a string and use EXECUTE IMMEDIATE.

for example (stmt not tested )
set revokeStmt = 'REVOKE ALL on ' || tbl || 'from AUser';
EXECUTE IMMEDIATE revokeStmt;

--

Chris Keating
Sybase Adaptive Server Anywhere Professional Version 8

************************************************** **************************
*
Sign up today for your copy of the SQL Anywhere Studio 9 Developer Edition
and try out the market-leading database for mobile, embedded and small to
medium sized business environments for free!

http://www.ianywhere.com/promos/deved/index.html

************************************************** **************************
*

iAnywhere Solutions http://www.iAnywhere.com

** Please only post to the newsgroup

** Whitepapers can be found at http://www.iAnywhere.com/developer
** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
** Use CaseXpress to report bugs http://casexpress.sybase.com

************************************************** **************************
*

"Bill McHugh" <wmchugh (AT) _remove_this_for_email_williamrmchugh (DOT) com> wrote in
message news:3fcfa638$1 (AT) forums-2-dub (DOT) ..
Quote:
I want to grant privileges on all the user tables in systable, but the
following gives ASA Error -141 "Table 'tbl' not found". Could someone
explain
how to do this? TIA.

FOR csr AS curs CURSOR FOR
(SELECT table_name AS tbl
FROM systable
WHERE creator = 101)
DO
REVOKE ALL on tbl from AUser;
GRANT ALL on tbl to AUser WITH GRANT OPTION;
END FOR;





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.