To All,
Serge, the SQL Cookbook by Anthony Molinaro is an outstanding one! Check out the code below (these are just two of his many, many solutions in his book). Also click on the link below.
--Use the recursive WITH clause to generate a sequence of rows with incrementing values.
--Use a one-row table such as t1 to kick off row generation; the WITH clause do the rest;
create table t1 (id integer);
insert into t1 values(1);
commit;
with x(id)
as (
select 1
from t1
union all
select id + 1
from x
where id + 1 <= 10
)
select * from x
--Following is a second, alternative solution for DB2 only.
--Its advantage is that it does not require a table.
with x(id)
as (
values(1)
union all
select id + 1
from x
where id + 1 <= 10
)
select * from x
http://www.amazon.com/gp/product/0596009763/qid=1133365872/sr=8-1/ref=pd_bbs_1/103-4505399-4063859?n=507846&s=books&v=glance
-----Original Message-----
From: Serge Rielau
[mailto:db2udbdba-ezmlmshield-x815704.[Email address protected]
Sent: Tuesday, January 24, 2006 10:21 AM
To: LazyDBA Discussion
Subject: RE: RUNSTATS from SP?
OK, please clarify your platform (are you on DB2 for LUW?).
If you have a C Procedure you can of course use the runstats API just fine,
The point is that the API only works in C. So if you have any other
interface you're in for some sort of wrapper.
ADMIN_CMD() provides this wrapper. So I can submit an EXPORT, RUNSTATS and
other "commands" from any clinet/language which has an SQL interface.
Cheres
Serge
"Kevin Knaus " <db2udbdba-ezmlmshield-x12113711.[Email address protected]
wrote on 01/24/2006 10:20:05 AM:
> Serge,
>
> This leads to the question, 'Is ADMIN_CMD()required to do a RUNSTATS
> from a stored proc or is it just an option among other methods?"
>
> Because if you issue a "RUNSTATS" command with its various options from
> within a stored proc the proc will build and will run without failing
> even if you don't use ADMIN_CMD.
>
> Thank you,
>
> Kevin Knaus
> -----Original Message-----
> From: Serge Rielau
> [mailto:db2udbdba-ezmlmshield-x99493447.[Email address protected]
> Sent: Monday, January 23, 2006 10:58 PM
> To: LazyDBA Discussion
> Subject: RE: RUNSTATS from SP?
>
> It's an SQL API. All client interfaces support an SQL API to DB2. So you
> can do runstats from Java, .NET, SQL Procedures....
>
> Cheers
> Serge
>
> "Yao Sheila " <db2udbdba-ezmlmshield-x54225714.[Email address
> protected]
> wrote on 01/23/2006 05:58:06 PM:
>
> >
> > I wonder what is the difference or advantage by using system procedure
> > ADMIN_CMD to run stats or reorg?
> >
> >
> > Thanks.
> >
> > Have a nice day,
> >
> > Sheila Yao
> >
> > -----Original Message-----
> > From: Serge Rielau
> > [mailto:db2udbdba-ezmlmshield-x174015.[Email address protected]
> > Sent: Monday, January 23, 2006 4:15 PM
> > To: LazyDBA Discussion
> > Subject: Re: RUNSTATS from SP?
> >
> >
> > Try the ADMIN_CMD() procedure in DB2 V8.2 (I think)
> >
> >
> >
> > "Diego Figueira " <db2udbdba-ezmlmshield-x78095642.[Email address
> > protected] wrote on 01/23/2006 09:07:49 AM:
> >
> > > Hi all, is there a way to execute a RUNSTATS command from a Stored
> > > Procedure?
> > >
> > >
> > >
> > > Thanks!
> > >
> > >
> > >
> > > Diego
> > >
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> > > website: http://www.LazyDBA.com
> > > To unsubscribe: http://www.lazydba.com/unsubscribe.html
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> > website: http://www.LazyDBA.com
> > To unsubscribe: http://www.lazydba.com/unsubscribe.html
> >
> >
> >
> > ---------------------------------------------------------------------
> > PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> > website: http://www.LazyDBA.com
> > To unsubscribe: http://www.lazydba.com/unsubscribe.html
> >
>
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
Please take a few minutes to provide feedback on the quality of service you received. The Department of Education values your feedback as a customer. Commissioner John L. Winn is committed to continuously assessing and improving the level and quality of services provided to you by Department staff. Simply use the link below. Thank you in advance for completing the survey.
http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]
DB2 & UDB email list listserv db2-l LazyDBA home page