<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WorkingScripts &#187; SQL</title>
	<atom:link href="http://workingscripts.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://workingscripts.com</link>
	<description>The Stuff that Just Works</description>
	<lastBuildDate>Mon, 07 Jun 2010 20:06:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL for Retrieving Portal, Security, Record and Navigation</title>
		<link>http://workingscripts.com/2009/06/peoplsoft-retrieving-portal-security-record-navigation/</link>
		<comments>http://workingscripts.com/2009/06/peoplsoft-retrieving-portal-security-record-navigation/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 19:38:00 +0000</pubDate>
		<dc:creator>Iouri Chadour</dc:creator>
				<category><![CDATA[PeopleSoft]]></category>
		<category><![CDATA[Portal]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://workingscripts.com/?p=61</guid>
		<description><![CDATA[

SELECT DISTINCT       ltrim (rtrim (a.classid))  AS classid, ltrim (rtrim (b.menuname))  AS       menuname, ltrim (rtrim (b.barname))  AS barname, ltrim          (rtrim (b.baritemname))  AS baritemname, ltrim(rtrim(d.pnlname))  AS      [...]]]></description>
			<content:encoded><![CDATA[</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 140.88%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 274px; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">SELECT</span> <span style="color: #0000ff">DISTINCT</span>       ltrim (rtrim (a.classid))  <span style="color: #0000ff">AS</span> classid, ltrim (rtrim (b.menuname))  <span style="color: #0000ff">AS</span>       menuname, ltrim (rtrim (b.barname))  <span style="color: #0000ff">AS</span> barname, ltrim          (rtrim (b.baritemname))  <span style="color: #0000ff">AS</span> baritemname, ltrim(rtrim(d.pnlname))  <span style="color: #0000ff">AS</span>       pnlname, ltrim (rtrim (d.itemlabel))  <span style="color: #0000ff">AS</span> itemlabel, ltrim          (rtrim (e.itemlabel))  <span style="color: #0000ff">AS</span> itemlabel, ltrim(rtrim(c.pageaccessdescr))         <span style="color: #0000ff">AS</span> pageaccessdescr, b.displayonly, ltrim (rtrim (f.portal_label))  <span style="color: #0000ff">AS</span>       portal_label, ltrim (rtrim (f.portal_objname))  <span style="color: #0000ff">AS</span> portal_objname,       ltrim(rtrim(f.portal_uri_seg1))  <span style="color: #0000ff">AS</span> portal_uri_seg1, ltrim (rtrim (f.portal_uri_seg2)       )  <span style="color: #0000ff">AS</span> portal_uri_seg2, (<span style="color: #0000ff">SELECT</span><span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> ltrim(rtrim(descr)) = <span style="color: #006080">''</span><span style="color: #0000ff">THEN</span>             ltrim(rtrim(menulabel))<span style="color: #0000ff">ELSE</span>             ltrim(rtrim(descr))<span style="color: #0000ff">END</span><span style="color: #0000ff">FROM</span> psmenudefn<span style="color: #0000ff">WHERE</span> menuname = b.menuname)       || <span style="color: #006080">' &gt; '</span>       || ltrim(rtrim(f.portal_label))  <span style="color: #0000ff">AS</span> <span style="color: #0000ff">path</span><span style="color: #0000ff">FROM</span> psroleclass a,       psauthitem b,       pspgeaccessdesc c,       pspnlgroup d,       psmenuitem e,       psprsmdefn f,       psprsmperm g<span style="color: #0000ff">WHERE</span> a.classid = b.classid<span style="color: #0000ff">AND</span> d.pnlgrpname = e.pnlgrpname<span style="color: #0000ff">AND</span> b.menuname = e.menuname<span style="color: #0000ff">AND</span> b.barname = e.barname<span style="color: #0000ff">AND</span> b.baritemname = e.itemname--<span style="color: #0000ff">AND</span> a.rolename <span style="color: #0000ff">LIKE</span> <span style="color: #006080">'GLIC_PO%'</span><span style="color: #0000ff">AND</span> b.menuname <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">IN</span> (<span style="color: #006080">'APPLICATION_DESIGNER'</span>,                              <span style="color: #006080">'CLIENTPROCESS'</span>,                              <span style="color: #006080">'DATA_MOVER '</span>,                              <span style="color: #006080">'IMPORT_MANAGER '</span>,                              <span style="color: #006080">'OBJECT_SECURITY '</span>,                              <span style="color: #006080">'QUERY '</span>,                              <span style="color: #006080">'PERFMONPPMI '</span>)<span style="color: #0000ff">AND</span> b.menuname <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">LIKE</span> <span style="color: #006080">'WEBLIB%'</span>

<span style="color: #0000ff">AND</span> B.PNLITEMNAME <span style="color: #0000ff">IN</span> (<span style="color: #0000ff">SELECT</span> <span style="color: #0000ff">DISTINCT</span> PNLNAME<span style="color: #0000ff">FROM</span> PSFSSYS.PSPNLFIELD<span style="color: #0000ff">where</span> RECNAME =<span style="color: #006080">'PYMNT_ADVICE'</span>)<span style="color: #0000ff">AND</span> <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">EXISTS</span>             (<span style="color: #0000ff">SELECT</span> <span style="color: #006080">'x'</span><span style="color: #0000ff">FROM</span> psprsmsysattrvl<span style="color: #0000ff">WHERE</span> portal_name = f.portal_name<span style="color: #0000ff">AND</span> portal_reftype = f.portal_reftype<span style="color: #0000ff">AND</span> portal_objname = f.portal_objname<span style="color: #0000ff">AND</span> portal_attr_nam = <span style="color: #006080">'PORTAL_HIDE_FROM_NAV'</span><span style="color: #0000ff">AND</span> f.portal_objname <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">IN</span> (<span style="color: #006080">'CO_NAVIGATION_COLLECTIONS'</span>,                                                  <span style="color: #006080">'PORTAL_BASE_DATA'</span>))<span style="color: #0000ff">AND</span> b.authorizedactions = c.authorizedactions<span style="color: #0000ff">AND</span> f.portal_reftype = <span style="color: #006080">'C'</span><span style="color: #0000ff">AND</span> f.portal_cref_usgt = <span style="color: #006080">'TARG'</span><span style="color: #0000ff">AND</span> f.portal_name = g.portal_name<span style="color: #0000ff">AND</span> f.portal_reftype = g.portal_reftype<span style="color: #0000ff">AND</span> f.portal_objname = g.portal_objname<span style="color: #0000ff">AND</span> a.classid = g.portal_permname<span style="color: #0000ff">AND</span> b.classid = g.portal_permname<span style="color: #0000ff">AND</span> f.portal_name = <span style="color: #006080">'EMPLOYEE'</span><span style="color: #0000ff">AND</span> f.portal_uri_seg1 &lt;&gt; <span style="color: #006080">' '</span><span style="color: #0000ff">AND</span> f.portal_uri_seg2 &lt;&gt; <span style="color: #006080">' '</span><span style="color: #0000ff">AND</span> f.portal_uri_seg3 &lt;&gt; <span style="color: #006080">' '</span><span style="color: #0000ff">AND</span> f.portal_uri_seg1 = b.menuname<span style="color: #0000ff">AND</span> b.pnlitemname = d.itemname  <span style="color: #0000ff">WITH</span> UR;
</pre>
<p></div>
]]></content:encoded>
			<wfw:commentRss>http://workingscripts.com/2009/06/peoplsoft-retrieving-portal-security-record-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Information about PeopleSoft Components from Database</title>
		<link>http://workingscripts.com/2008/06/peoplesoft-components-database/</link>
		<comments>http://workingscripts.com/2008/06/peoplesoft-components-database/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 22:20:00 +0000</pubDate>
		<dc:creator>Iouri Chadour</dc:creator>
				<category><![CDATA[PeopleSoft]]></category>
		<category><![CDATA[PeopleTools]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://workingscripts.com/?p=44</guid>
		<description><![CDATA[SQLs below have proved to be great while working behind the scenes and creating report about PeopleSoft customizations. These are quick ways to get behind the scenes and see the objects the way PeopleSoft sees it.
Getting fields and records for a page:


select OCCURSLEVEL as level ,FIELDNUM as taborder, LBLTEXT as label ,
RECNAME as record ,FIELDNAME [...]]]></description>
			<content:encoded><![CDATA[<p>SQLs below have proved to be great while working behind the scenes and creating report about PeopleSoft customizations. These are quick ways to get behind the scenes and see the objects the way PeopleSoft sees it.</p>
<p><strong>Getting fields and records for a page:</strong></p>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #0000ff">select</span> OCCURSLEVEL <span style="color: #0000ff">as</span> <span style="color: #0000ff">level</span> ,FIELDNUM <span style="color: #0000ff">as</span> taborder, LBLTEXT <span style="color: #0000ff">as</span> label ,
RECNAME <span style="color: #0000ff">as</span> record ,FIELDNAME <span style="color: #0000ff">as</span> field<span style="color: #0000ff">
from</span> PSFSSYS.PSPNLFIELD
<span style="color: #0000ff">where</span> PNLNAME =<span style="color: #006080">'PORTAL_HPCOMP'</span><span style="color: #0000ff">order</span> <span style="color: #0000ff">by</span> OCCURSLEVEL, FIELDNUM</pre>
</div>
<p><strong>Get information about Project Compares :</strong></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #0000ff">SELECT</span> PROJECTNAME, VERSION, PROJECTDESCR, TGTSERVERNAME, TGTDBNAME, TGTOPRID,
TGTOPRACCT, COMPRELEASE, SRCCOMPRELDTTM, TGTCOMPRELDTTM, COMPRELDTTM, KEEPTGT,
TGTORIENTATION, COMPARETYPE,
COMMITLIMIT, REPORTFILTER, MAINTPROJ, LASTUPDDTTM, LASTUPDOPRID, RELEASELABEL,
RELEASEDTTM, OBJECTOWNERID, DESCRLONG <span style="color: #0000ff">FROM</span> PSPROJECTDEFN</pre>
</div>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
<p>G<strong>et Record Audit Flags:</strong></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #0000ff">SELECT</span> RECNAME, FIELDNUM, FIELDNAME,
<span style="color: #0000ff">INTEGER</span>(USEEDIT / 8) - <span style="color: #0000ff">INTEGER</span> (USEEDIT / 16) * 2 <span style="color: #0000ff">as</span> "<span style="color: #0000ff">ADD</span>", <span style="color: #0000ff">
INTEGER</span>(USEEDIT / 128) - <span style="color: #0000ff">INTEGER</span>(USEEDIT / 256)*2 <span style="color: #0000ff">as</span> "CHANGE", <span style="color: #0000ff">
INTEGER</span>(USEEDIT / 1024) - <span style="color: #0000ff">INTEGER</span>(USEEDIT/ 2048)*2  <span style="color: #0000ff">as</span> "<span style="color: #0000ff">DELETE</span>"
<span style="color: #0000ff">FROM</span> PSRECFIELD <span style="color: #0000ff">
     WHERE</span>  RECNAME = <span style="color: #006080">'PSOPRDEFN'</span> <span style="color: #0000ff">
             and</span> USEEDIT &lt;&gt; 0       <span style="color: #0000ff">
             AND</span> (<span style="color: #0000ff">INTEGER</span> (USEEDIT / 128) - <span style="color: #0000ff">INTEGER</span> (USEEDIT / 256) * 2 &lt;&gt; 0
             <span style="color: #0000ff">OR</span> <span style="color: #0000ff">INTEGER</span> (USEEDIT / 8) - <span style="color: #0000ff">INTEGER</span> (USEEDIT / 16) * 2 &lt;&gt; 0
             <span style="color: #0000ff">OR</span> <span style="color: #0000ff">INTEGER</span> (USEEDIT / 1024) - <span style="color: #0000ff">INTEGER</span> (USEEDIT / 2048) * 2 &lt;&gt; 0)
            <span style="color: #0000ff">ORDER</span> <span style="color: #0000ff">BY</span> RECNAME, FIELDNUM;</pre>
</div>
<p><strong>Get Record Field Types and Definitions:</strong></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #008000">-- GET RECORD NAME DEFINITION
</span><span style="color: #0000ff">  SELECT</span> A.RECNAME, A.FIELDNAME,
         <span style="color: #0000ff">CASE</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 0  <span style="color: #0000ff">THEN</span> <span style="color: #006080">'CHAR'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 1       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'LONG CHAR'</span>          <span style="color: #0000ff">
            WHEN</span> B.FIELDTYPE = 2       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'NUMBER'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 3       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'SIGNED NBR'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 4       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'DATE'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 5       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'TIME'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 6       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'DATETIME'</span>
            <span style="color: #0000ff">WHEN</span> B.FIELDTYPE = 7 <span style="color: #0000ff">OR</span> B.FIELDTYPE = 8       <span style="color: #0000ff">THEN</span>   <span style="color: #006080">'IMAGE'</span>          <span style="color: #0000ff">
            ELSE</span>  <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">
         END</span>  <span style="color: #0000ff">AS</span> FIELDTYPE,
         <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">
             WHEN</span> B.FIELDTYPE = 2       <span style="color: #0000ff">
                  OR</span> B.FIELDTYPE = 3  <span style="color: #0000ff">THEN</span>  RTRIM (<span style="color: #0000ff">CHAR</span> (B.LENGTH))|| <span style="color: #006080">'.'</span>||<span style="color: #0000ff">CHAR</span> (B.DECIMALPOS)          <span style="color: #0000ff">
             ELSE</span> <span style="color: #0000ff">CHAR</span> (B.LENGTH)       <span style="color: #0000ff">
         END</span>  <span style="color: #0000ff">AS</span> FLDLEN,
         <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">
            WHEN</span> (A.USEEDIT/ 256)/ 2 &lt;&gt;  (A.USEEDIT/ 256)/ 2.0       <span style="color: #0000ff">
                  THEN</span> <span style="color: #006080">'YES'</span> <span style="color: #0000ff">ELSE</span> <span style="color: #006080">'NO'</span>
         <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> REQ,
         <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">
             WHEN</span> A.USEEDIT/ 2 &lt;&gt; A.USEEDIT/ 2.0       <span style="color: #0000ff">
                  THEN</span>             <span style="color: #006080">'KEY'</span>          <span style="color: #0000ff">
             WHEN</span> (A.USEEDIT/ 2)/ 2 &lt;&gt; (A.USEEDIT/ 2)/ 2.0       <span style="color: #0000ff">
                  THEN</span>             <span style="color: #006080">'DUP'</span>
             <span style="color: #0000ff">WHEN</span> (A.USEEDIT/ 16)/ 2 &lt;&gt;(A.USEEDIT/16)/ 2.0
                  <span style="color: #0000ff">THEN</span> <span style="color: #006080">'ALT'</span>          <span style="color: #0000ff">
             ELSE</span> <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">
        END</span>  <span style="color: #0000ff">AS</span> KEY_TYPE, <span style="color: #0000ff">
        CASE</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 64) / 2 &lt;&gt; (A.USEEDIT/64)/2.0       <span style="color: #0000ff">
                  THEN</span>             <span style="color: #006080">'DESC'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 2 &lt;&gt; A.USEEDIT / 2.0       <span style="color: #0000ff">
                  OR</span> (A.USEEDIT / 2) / 2 &lt;&gt; (A.USEEDIT / 2) / 2.0       <span style="color: #0000ff">
                  OR</span> (A.USEEDIT / 16) / 2 &lt;&gt; (A.USEEDIT / 16) / 2.0)       <span style="color: #0000ff">
                  AND</span> (A.USEEDIT / 64) / 2 = (A.USEEDIT / 64) / 2.0       <span style="color: #0000ff">
                  THEN</span>             <span style="color: #006080">'ASC'</span>
           <span style="color: #0000ff">ELSE</span>             <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">
        END</span>  <span style="color: #0000ff">AS</span> DIR,
        <span style="color: #0000ff">CASE</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 2048) / 2 &lt;&gt; (A.USEEDIT / 2048) / 2.0       <span style="color: #0000ff">
                 THEN</span>             <span style="color: #006080">'YES'</span>
            <span style="color: #0000ff">ELSE</span>             <span style="color: #006080">'NO'</span>
        <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> SRCH,
        <span style="color: #0000ff">CASE</span>
           <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 32) / 2 &lt;&gt; (A.USEEDIT / 32) / 2.0
                <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'YES'</span>
           <span style="color: #0000ff">ELSE</span>             <span style="color: #006080">'NO'</span>
        <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> LIST,
        <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 4)/ 2 &lt;&gt;(A.USEEDIT / 4)/ 2.0       <span style="color: #0000ff">
            THEN</span>             <span style="color: #006080">'YES'</span>
        <span style="color: #0000ff">    ELSE</span>             <span style="color: #006080">'NO'</span>
        <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> SYS, <span style="color: #0000ff">
        CASE</span>
            <span style="color: #0000ff">WHEN</span> A.DEFRECNAME = <span style="color: #006080">''</span>       <span style="color: #0000ff">
             THEN</span>             A.DEFFIELDNAME
             <span style="color: #0000ff">ELSE</span>             RTRIM(A.DEFRECNAME)|| <span style="color: #006080">'.'</span>|| A.DEFFIELDNAME
        <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> DEFAULT_VALUE, <span style="color: #0000ff">
        CASE</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 &lt;&gt; (A.USEEDIT / 8) / 2.0
                 <span style="color: #0000ff">AND</span> (A.USEEDIT / 128) / 2 = (A.USEEDIT / 128) / 2.0       <span style="color: #0000ff">
                 AND</span> (A.USEEDIT / 1024) / 2 = (A.USEEDIT / 1024) / 2.0       <span style="color: #0000ff">
            THEN</span>             <span style="color: #006080">'A'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 &lt;&gt; (A.USEEDIT / 8) / 2.0       <span style="color: #0000ff">
                  AND</span> (A.USEEDIT / 128) / 2 &lt;&gt; (A.USEEDIT / 128) / 2.0       <span style="color: #0000ff">
                  AND</span> (A.USEEDIT / 1024) / 2 = (A.USEEDIT / 1024) / 2.0
            <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'AC'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 &lt;&gt; (A.USEEDIT / 8) / 2.0
                  <span style="color: #0000ff">AND</span> (A.USEEDIT / 128) / 2 &lt;&gt; (A.USEEDIT / 128) / 2.0
                  <span style="color: #0000ff">AND</span> (A.USEEDIT / 1024) / 2 &lt;&gt; (A.USEEDIT / 1024) / 2.0       <span style="color: #0000ff">
            THEN</span>             <span style="color: #006080">'ACD'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 = (A.USEEDIT / 8) / 2.0
                  <span style="color: #0000ff">AND</span> (A.USEEDIT / 128) / 2 &lt;&gt; (A.USEEDIT / 128) / 2.0       <span style="color: #0000ff">
                  AND</span> (A.USEEDIT / 1024) / 2 = (A.USEEDIT / 1024) / 2.0
            <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'C'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 = (A.USEEDIT / 8) / 2.0
            <span style="color: #0000ff">     AND</span> (A.USEEDIT / 128) / 2 &lt;&gt; (A.USEEDIT / 128) / 2.0
                 <span style="color: #0000ff">AND</span> (A.USEEDIT / 1024) / 2 &lt;&gt; (A.USEEDIT / 1024) / 2.0
                 <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'CD'</span>
            <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8) / 2 = (A.USEEDIT / 8) / 2.0       <span style="color: #0000ff">
                 AND</span> (A.USEEDIT / 128) / 2 = (A.USEEDIT / 128) / 2.0
                 <span style="color: #0000ff">AND</span> (A.USEEDIT / 1024) / 2 &lt;&gt; (A.USEEDIT / 1024) / 2.0
           <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'D'</span>
           <span style="color: #0000ff">ELSE</span>             <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">
           END</span>  <span style="color: #0000ff">AS</span> AUDT, <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 16384) / 2 &lt;&gt;          (A.USEEDIT / 16384) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'PROMPT'</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 512) / 2 &lt;&gt;          (A.USEEDIT / 512) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'XLAT'</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 8192) / 2 &lt;&gt;          (A.USEEDIT / 8192) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'Y/N'</span>          <span style="color: #0000ff">ELSE</span>             <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> EDIT, A.EDITTABLE  <span style="color: #0000ff">AS</span> PROMPT_TABLE, A.SETCNTRLFLD  <span style="color: #0000ff">AS</span>       SET_CONTROL_FLD, <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 4096) / 2 &lt;&gt;          (A.USEEDIT / 4096) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'YES'</span>          <span style="color: #0000ff">ELSE</span>             <span style="color: #006080">'NO'</span>       <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> REASONABLE_DT, <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT       / 32768)       / 2 &lt;&gt;          (A.USEEDIT       / 32768)       / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'YES'</span>          <span style="color: #0000ff">ELSE</span>             <span style="color: #006080">'NO'</span>       <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> AUTO_UPDT, <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 262144) / 2 &lt;&gt; (A.USEEDIT / 262144) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'FROM'</span>          <span style="color: #0000ff">WHEN</span> (A.USEEDIT / 524288) / 2 &lt;&gt; (A.USEEDIT / 524288) / 2.0       <span style="color: #0000ff">THEN</span>             <span style="color: #006080">'THROUGH'</span>          <span style="color: #0000ff">ELSE</span>             <span style="color: #0000ff">NULL</span>       <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> SEARCH_FIELD, <span style="color: #0000ff">CASE</span>          <span style="color: #0000ff">WHEN</span> A.SUBRECORD = <span style="color: #006080">'Y'</span> <span style="color: #0000ff">THEN</span> <span style="color: #006080">'YES'</span>          <span style="color: #0000ff">ELSE</span> <span style="color: #006080">'NO'</span>       <span style="color: #0000ff">END</span>  <span style="color: #0000ff">AS</span> SUBRECORD, A.LASTUPDDTTM, A.LASTUPDOPRID  <span style="color: #0000ff">FROM</span> PSRECFIELD A, PSDBFIELD B <span style="color: #0000ff">WHERE</span> A.RECNAME = <span style="color: #006080">'PSOPRDEFN'</span> <span style="color: #0000ff">AND</span> A.FIELDNAME = B.FIELDNAME<span style="color: #0000ff">ORDER</span> <span style="color: #0000ff">BY</span> FIELDNUM</pre>
</div>
<p><strong></strong></p>
<p><strong>Get Field Translate Values:</strong></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #0000ff">SELECT</span> fieldvalue, eff_status, xlatlongname     <span style="color: #0000ff">FROM</span> psxlatitem i     <span style="color: #0000ff">WHERE</span> fieldname = <span style="color: #006080">'RUNSTATUS'</span>     <span style="color: #0000ff">AND</span> effdt = (         <span style="color: #0000ff">SELECT</span> <span style="color: #0000ff">max</span>(effdt)         <span style="color: #0000ff">FROM</span>   psxlatitem i1         <span style="color: #0000ff">WHERE</span>  i1.fieldname = i.fieldname         <span style="color: #0000ff">AND</span>    i1.fieldvalue = i.fieldvalue         <span style="color: #0000ff">AND</span>    i1.effdt &lt;= <span style="color: #0000ff">CURRENT</span> <span style="color: #0000ff">DATE</span>)    <span style="color: #0000ff">ORDER</span> <span style="color: #0000ff">BY</span> <span style="color: #0000ff">INTEGER</span>(fieldvalue)</pre>
</div>
<p><strong>Get information about PS Queries:</strong></p>
<div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;">
<pre id="codeSnippet" style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: #f4f4f4; text-align: left;"><span style="color: #008000">-- Get Query Definition</span><span style="color: #0000ff">SELECT</span> OPRID, QRYNAME, DESCR, VERSION, LASTUPDDTTM, LASTUPDOPRID, QRYAPPROVED, CREATEOPRID,       CREATEDTTM,  QRYDISABLED,       QRYFOLDER, DESCRLONG  <span style="color: #0000ff">FROM</span> PSFSSYS.PSQRYDEFN    <span style="color: #0000ff">where</span> QRYNAME = <span style="color: #006080">'?'</span>    <span style="color: #0000ff">and</span> oprid = <span style="color: #006080">'?'</span><span style="color: #0000ff">with</span> ur;

<span style="color: #008000">-- Get Query Bind Variables</span><span style="color: #0000ff">SELECT</span> OPRID, QRYNAME, BNDNAME, BNDNUM, FIELDNAME, HDGTYPE, HEADING, FIELDTYPE       , LENGTH, DECIMALPOS, FORMAT, EDITTABLE, USECOUNT, USEEDIT  <span style="color: #0000ff">FROM</span> PSFSSYS.PSQRYBIND    <span style="color: #0000ff">where</span> QRYNAME <span style="color: #0000ff">like</span> <span style="color: #006080">'?%'</span>    <span style="color: #0000ff">and</span> oprid = <span style="color: #006080">'?'</span>    <span style="color: #0000ff">with</span> ur;

<span style="color: #008000">-- Get Query Criteria</span><span style="color: #0000ff">SELECT</span> OPRID, QRYNAME, SELNUM, CRTNUM, COMBTYPE, NEGATION, LPARENLVL,       LCRTSELNUM, LCRTFLDNUM, CONDTYPE, EXPRTYPE, R1CRTSELNUM, R1CRTFLDNUM,       R1CRTEXPNUM, R2CRTSELNUM, R2CRTFLDNUM, R2CRTEXPNUM, RPARENLVL,       QRYOJSELNUM  <span style="color: #0000ff">FROM</span> PSFSSYS.PSQRYCRITERIA    <span style="color: #0000ff">where</span> QRYNAME = <span style="color: #006080">'?'</span>    <span style="color: #0000ff">and</span> oprid = <span style="color: #006080">'?'</span><span style="color: #0000ff">with</span> ur;

<span style="color: #008000">-- Get Query Output Field Definitions</span><span style="color: #0000ff">SELECT</span> OPRID, QRYNAME, QRYFLDNAME, SELNUM, FLDNUM, RECNAME, FIELDNAME,       FLDRCDNUM, FLDEXPNUM, HDGTYPE, HEADING, COLUMNNUM, GROUPBYNUM,       ORDERBYNUM, ORDERBYDIR, TTLTYPE, SUBTTLNUM, USECOUNT, XLATTYPE,       XLATEXPRTYPE, XLATFLDNUM, XLATEXPNUM, AGGREGATEFUNC  <span style="color: #0000ff">FROM</span> PSFSSYS.PSQRYFIELD    <span style="color: #0000ff">where</span> QRYNAME  <span style="color: #0000ff">like</span> <span style="color: #006080">'?%'</span>     <span style="color: #0000ff">with</span> ur;</pre>
</div>
<p>If you have more information about this kind of handy SQLs – please comment and I will try and keep this post up to date.</p>
]]></content:encoded>
			<wfw:commentRss>http://workingscripts.com/2008/06/peoplesoft-components-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting a lot of rows fast</title>
		<link>http://workingscripts.com/2008/03/deleting-rows-fast/</link>
		<comments>http://workingscripts.com/2008/03/deleting-rows-fast/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 21:36:00 +0000</pubDate>
		<dc:creator>Iouri Chadour</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://workingscripts.com/?p=36</guid>
		<description><![CDATA[Need to delete millions of rows from a table fast? Here is how you can do this:


   1: ALTER TABLE table_name ACTIVATE NOT LOGGED INITIALLY; --disable logging

   2: DELETE FROM table_name WHERE ....;

   3: COMMIT; --Commits and enable logging


]]></description>
			<content:encoded><![CDATA[<p>Need to delete millions of rows from a table fast? Here is how you can do this:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 133.32%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 102px; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">ALTER</span> <span style="color: #0000ff">TABLE</span> table_name ACTIVATE <span style="color: #0000ff">NOT</span> LOGGED <span style="color: #0000ff">INITIALLY</span>; --disable logging</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">DELETE</span> <span style="color: #0000ff">FROM</span> table_name <span style="color: #0000ff">WHERE</span> ....;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #0000ff">COMMIT</span>; --Commits <span style="color: #0000ff">and</span> enable logging</pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://workingscripts.com/2008/03/deleting-rows-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Non-Shared Temp Tables Cleanup</title>
		<link>http://workingscripts.com/2008/03/nonshared-temp-tables-cleanup/</link>
		<comments>http://workingscripts.com/2008/03/nonshared-temp-tables-cleanup/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 22:26:00 +0000</pubDate>
		<dc:creator>Iouri Chadour</dc:creator>
				<category><![CDATA[PeopleSoft]]></category>
		<category><![CDATA[PeopleTools]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://workingscripts.com/?p=42</guid>
		<description><![CDATA[Some of the processes that depend on shared table instances , can experience a dramatic differences in performance, in case all of the instances available are being used, or remaining locked by some orphan or failed process. One way to resolve this problem is to go online and check if tables should be “released”. Here [...]]]></description>
			<content:encoded><![CDATA[<p>Some of the processes that depend on shared table instances , can experience a dramatic differences in performance, in case all of the instances available are being used, or remaining locked by some orphan or failed process. One way to resolve this problem is to go online and check if tables should be “released”. Here is a set of SQLs that would allow you to do the same thing and depending on you requirements – allow to automate this process, which could prove critical during the times of high usage:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 99.49%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; height: 340px; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #008000">-- Shared Temp Table instance control table</span><span style="color: #0000ff">SELECT</span>  * <span style="color: #0000ff">FROM</span> PS_TEMP_TBL_ASGNM<span style="color: #0000ff">WHERE</span> TEMP_TBL_NAME = <span style="color: #006080">'table_name'</span><span style="color: #0000ff">WITH</span> UR

<span style="color: #008000">-- Get tables that were locked by processes that ran 200 instance numbers before</span><span style="color: #0000ff">SELECT</span>  * <span style="color: #0000ff">FROM</span> PS_TEMP_TBL_ASGNM<span style="color: #0000ff">WHERE</span> in_use_sw = <span style="color: #006080">'Y'</span> <span style="color: #0000ff">AND</span> process_instance &lt; (<span style="color: #0000ff">SELECT</span> <span style="color: #0000ff">max</span> (prcsinstance) - 200                                                 <span style="color: #0000ff">FROM</span> psfssys.psprcsrqst                                                <span style="color: #0000ff">WHERE</span> runstatus = <span style="color: #006080">'9'</span>)<span style="color: #0000ff">with</span> ur

<span style="color: #008000">-- RELEASE ALL TEMP TABLE LOCKS </span><span style="color: #008000">-- FROM PROCESS INSTANCES THAT ARE LESS THAN 200 THAN THE LAST SUCCESSFUL ONE</span><span style="color: #0000ff">UPDATE</span> ps_temp_tbl_asgnm   <span style="color: #0000ff">SET</span> in_use_sw = <span style="color: #006080">'N'</span>, PROCESS_INSTANCE = 0<span style="color: #0000ff">WHERE</span> in_use_sw = <span style="color: #006080">'Y'</span> <span style="color: #0000ff">AND</span> process_instance  &lt; (<span style="color: #0000ff">SELECT</span> <span style="color: #0000ff">max</span> (prcsinstance) - 200                                                 <span style="color: #0000ff">FROM</span> psfssys.psprcsrqst                                                <span style="color: #0000ff">WHERE</span> runstatus = <span style="color: #006080">'9'</span>)

</pre>
<p></div>
<p>Let me know if you have any questions</p>
]]></content:encoded>
			<wfw:commentRss>http://workingscripts.com/2008/03/nonshared-temp-tables-cleanup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB2 Scripts &#8211; Table Management</title>
		<link>http://workingscripts.com/2008/03/db2-table-management/</link>
		<comments>http://workingscripts.com/2008/03/db2-table-management/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 01:39:00 +0000</pubDate>
		<dc:creator>Iouri Chadour</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://workingscripts.com/?p=45</guid>
		<description><![CDATA[Here are a few more nice DB2 scripts that would save you time:
Get all tables in Table Space

-- Get all tables in particular tablespaceselect SUBSTR(TABNAME,1,25) &#34;TABNAME&#34;, SUBSTR(TABSCHEMA,1,15) &#34;SCHEMA&#34;, NPAGES, CARD from syscat.tables where tbspace = '?'

Generate Grants for all tables in Table Space

-- Genereating GRANTS SELECT 'grant select on ' &#124;&#124; tabname &#124;&#124; ' to [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a few more nice DB2 scripts that would save you time:</p>
<p><strong>Get all tables in Table Space</strong></p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #008000">-- Get all tables in particular tablespace</span><span style="color: #0000ff">select</span> SUBSTR(TABNAME,1,25) &quot;TABNAME&quot;, SUBSTR(TABSCHEMA,1,15) &quot;<span style="color: #0000ff">SCHEMA</span>&quot;, NPAGES, CARD <span style="color: #0000ff">from</span> syscat.tables <span style="color: #0000ff">where</span> tbspace = <span style="color: #006080">'?'</span></pre>
<p></div>
<p><strong>Generate Grants for all tables in Table Space</strong></p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #008000">-- Genereating GRANTS </span><span style="color: #0000ff">SELECT</span> <span style="color: #006080">'grant select on '</span> || tabname || <span style="color: #006080">' to PSFDEV'</span> || <span style="color: #006080">';'</span>  <span style="color: #0000ff">FROM</span> syscat.tables <span style="color: #0000ff">WHERE</span> tabname <span style="color: #0000ff">NOT</span> <span style="color: #0000ff">IN</span> (<span style="color: #0000ff">SELECT</span> tabname                         <span style="color: #0000ff">FROM</span> syscat.tabauth                        <span style="color: #0000ff">WHERE</span> grantee = <span style="color: #006080">'PSFDEV'</span>)   <span style="color: #0000ff">AND</span> tabschema = <span style="color: #006080">'PSFSSYS'</span>   <span style="color: #0000ff">AND</span> (type = <span style="color: #006080">'T'</span> <span style="color: #0000ff">OR</span> type = <span style="color: #006080">'V'</span>)</pre>
<p></div>
]]></content:encoded>
			<wfw:commentRss>http://workingscripts.com/2008/03/db2-table-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
