<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Code400 -The Support Alternative - SQL</title>
		<link>http://www.code400.com/forum/</link>
		<description>command line and embedded sql</description>
		<language>en</language>
		<lastBuildDate>Fri, 10 Sep 2010 03:48:12 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.code400.com/forum/images/misc/rss.png</url>
			<title>Code400 -The Support Alternative - SQL</title>
			<link>http://www.code400.com/forum/</link>
		</image>
		<item>
			<title>SQL Update Null Value</title>
			<link>http://www.code400.com/forum/showthread.php/9649-SQL-Update-Null-Value?goto=newpost</link>
			<pubDate>Wed, 08 Sep 2010 19:45:58 GMT</pubDate>
			<description><![CDATA[Can someone explain this to me? 
 
 
PHP: 
--------- 
Update TOFILE A                       
 Set ( iGRP3, iGRP4 )                 
   = ( Select coalesce( iGRP3, ' ' ), 
              coalesce( iGRP4, ' ' )  
         from FROMFILE B]]></description>
			<content:encoded><![CDATA[<div>Can someone explain this to me?<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">Update&nbsp;TOFILE&nbsp;A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;Set&nbsp;</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">iGRP3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">iGRP4&nbsp;</span><span style="color: #007700">)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;=&nbsp;(&nbsp;</span><span style="color: #0000BB">Select&nbsp;coalesce</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">iGRP3</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&nbsp;'&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">coalesce</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">iGRP4</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&nbsp;'&nbsp;</span><span style="color: #007700">)&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">from&nbsp;FROMFILE&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Where&nbsp;A</span><span style="color: #007700">.</span><span style="color: #0000BB">iACTV&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">B</span><span style="color: #007700">.</span><span style="color: #0000BB">iACTV&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">and&nbsp;</span><span style="color: #0000BB">A</span><span style="color: #007700">.</span><span style="color: #0000BB">iSTOR&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">B</span><span style="color: #007700">.</span><span style="color: #0000BB">iSTOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">and&nbsp;</span><span style="color: #0000BB">A</span><span style="color: #007700">.</span><span style="color: #0000BB">iITEM&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">B</span><span style="color: #007700">.</span><span style="color: #0000BB">iITEM&nbsp;&nbsp;</span><span style="color: #007700">)&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> Gives me the message:<br />
<br />
 Null values not allowed in column or variable IGRP3.<br />
<br />
I'm forcing the value to be either the actual value or *blank... <br />
<br />
What gives??<br />
<br />
:duh</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>FaStOnE</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9649-SQL-Update-Null-Value</guid>
		</item>
		<item>
			<title><![CDATA[my lastest and greatest "Stupid SQL Tricks"]]></title>
			<link>http://www.code400.com/forum/showthread.php/9647-my-lastest-and-greatest-quot-Stupid-SQL-Tricks-quot?goto=newpost</link>
			<pubDate>Wed, 08 Sep 2010 17:22:43 GMT</pubDate>
			<description><![CDATA[is it not possible to use with in an insert?  
 
Code: 
--------- 
Insert Into QTemp/FinTotals (                                       
  With t1 As (                                                      
  Select Cast(' ' As Char(1)) As Reg,                               
  Cast(' ' as Char(7)) As...]]></description>
			<content:encoded><![CDATA[<div>is it not possible to use <i>with</i> in an insert? <br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">Insert Into QTemp/FinTotals (&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; With t1 As (&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; Select Cast(' ' As Char(1)) As Reg,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; Cast(' ' as Char(7)) As CustNo,Cast(' ' As Char(30)) As&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; CustName,Cast(Sum( Invoiced ) As Dec(15,2)) As Invoiced,&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; Cast(Sum( PayOff ) As Dec(15,2)) As PayOff, Cast(Sum(Payment) As <br />
&nbsp;  Dec(15,2)) As Payment,Cast(Sum(Balance ) As Dec(15,2)) As&nbsp; &nbsp; &nbsp;  <br />
&nbsp; Balance&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; From RO1050XL_1)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; Select a.Reg,a.CustNo,a.CustName,a.Invoiced,a.PayOff,a.Payment,&nbsp; <br />
&nbsp; Case When (a.Payment <> 0 And a.PayOff <> 0) Then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; Cast((((a.Payment / a.PayOff) * 100))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  As Dec(15,2))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; Else 0 End As Percent,a.Balance From t1 a&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
);</code><hr />
</div> if not...then why the hell not???? please save me...it's dark in here:duh</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>tomholden</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9647-my-lastest-and-greatest-quot-Stupid-SQL-Tricks-quot</guid>
		</item>
		<item>
			<title>Adding new member in SQL table</title>
			<link>http://www.code400.com/forum/showthread.php/9580-Adding-new-member-in-SQL-table?goto=newpost</link>
			<pubDate>Mon, 23 Aug 2010 07:13:06 GMT</pubDate>
			<description>Hi Folks, 
 
There is SQl table , i need to add a new member in that table. For that purpose i am trying with ADDPFM but in this case an error occures. 
 
Is there any way to add new member in SQL table?? 
 
Pramendra</description>
			<content:encoded><![CDATA[<div>Hi Folks,<br />
<br />
There is SQl table , i need to add a new member in that table. For that purpose i am trying with ADDPFM but in this case an error occures.<br />
<br />
Is there any way to add new member in SQL table??<br />
<br />
Pramendra</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>pramendra</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9580-Adding-new-member-in-SQL-table</guid>
		</item>
		<item>
			<title>CASE / IF in SQL</title>
			<link>http://www.code400.com/forum/showthread.php/9568-CASE-IF-in-SQL?goto=newpost</link>
			<pubDate>Thu, 19 Aug 2010 12:13:24 GMT</pubDate>
			<description>Hej 
 
Im new to query on as400. 
And i would be greatfull if you guys could help. 
 
Im trying to create a query where i want the sql to calculate for me. 
I have a field that determins if the coustomer pays 1/2/4 times a year. 
And another field that shows the price 
So i want it to calculate...</description>
			<content:encoded><![CDATA[<div>Hej<br />
<br />
Im new to query on as400.<br />
And i would be greatfull if you guys could help.<br />
<br />
Im trying to create a query where i want the sql to calculate for me.<br />
I have a field that determins if the coustomer pays 1/2/4 times a year.<br />
And another field that shows the price<br />
So i want it to calculate something like<br />
IF PPFOF (nummer of times the customer pays) = 2<br />
Then PPPRM (price) * PPFOF<br />
<br />
Can i do that?</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>SinCityLegend</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9568-CASE-IF-in-SQL</guid>
		</item>
		<item>
			<title>Embeded SQL FETCH FIRST x ROWS</title>
			<link>http://www.code400.com/forum/showthread.php/9565-Embeded-SQL-FETCH-FIRST-x-ROWS?goto=newpost</link>
			<pubDate>Wed, 18 Aug 2010 17:13:40 GMT</pubDate>
			<description>Can we use a variable value for the FETCH FIRST x ROWS? 
 
Something like: 
 
 
PHP: 
--------- 
Select Name, Address, City, State, Zip, Phone 
From   MyTable 
Where Zip = 85024</description>
			<content:encoded><![CDATA[<div>Can we use a variable value for the FETCH FIRST x ROWS?<br />
<br />
Something like:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">Select&nbsp;Name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Address</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">City</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">State</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Zip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">Phone<br />From&nbsp;&nbsp;&nbsp;MyTable<br />Where&nbsp;Zip&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">85024<br />Fetch&nbsp;First&nbsp;</span><span style="color: #007700">:</span><span style="color: #0000BB">Num&nbsp;Rows&nbsp;Only</span><span style="color: #007700">;&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> If not, how could this be accomplished?  <br />
<br />
(Sorry, working in COBOL and trying to help a colleague)<br />
<br />
Thanks!</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>FaStOnE</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9565-Embeded-SQL-FETCH-FIRST-x-ROWS</guid>
		</item>
		<item>
			<title>Determine library or schema creation</title>
			<link>http://www.code400.com/forum/showthread.php/9558-Determine-library-or-schema-creation?goto=newpost</link>
			<pubDate>Tue, 17 Aug 2010 13:45:08 GMT</pubDate>
			<description>Hi All, 
 
How can we determine from the library object that it is created via SQL or AS400 CRTLIB command? 
I have created library by two ways 
1) SQL - Create Schema 
2) AS400 - CRTLIB 
 
Now from the object MyLib how we can determine the difference whether it is created by SQL or AS400? 
Here I...</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
<br />
How can we determine from the library object that it is created via SQL or AS400 CRTLIB command?<br />
I have created library by two ways<br />
1) SQL - Create Schema<br />
2) AS400 - CRTLIB<br />
<br />
Now from the object MyLib how we can determine the difference whether it is created by SQL or AS400?<br />
Here I can see only the text difference in both the objects,<br />
If it is created by SQL then text will be 'created by SQL' &amp; if it is created with CRTLIB then user text will come. Apart from this is there any difference to determine?</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>Nil</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9558-Determine-library-or-schema-creation</guid>
		</item>
		<item>
			<title>Using AS to correlate a table</title>
			<link>http://www.code400.com/forum/showthread.php/9550-Using-AS-to-correlate-a-table?goto=newpost</link>
			<pubDate>Mon, 16 Aug 2010 05:29:59 GMT</pubDate>
			<description>Some days I hate SQL! 
 
The following statement works fine in interactive SQL: 
 
 
Code: 
--------- 
SELECT            
i1.odlbnm,i1.odobnm,i1.odobtp,i1.odobat,i1.odcdat,                     
i3.odobnm,i3.odobtp,i3.odobat,i3.odcdat</description>
			<content:encoded><![CDATA[<div>Some days I hate SQL!<br />
<br />
The following statement works fine in interactive SQL:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">SELECT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
i1.odlbnm,i1.odobnm,i1.odobtp,i1.odobat,i1.odcdat,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
i3.odobnm,i3.odobtp,i3.odobat,i3.odcdat&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
FROM fmpscsrco AS i1 FULL OUTER JOIN fmpsctgto AS i3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
ON i1.odlbnm=i3.odlbnm and i1.odobnm=i3.odobnm AND i1.odobtp=i3.odobtp</code><hr />
</div> But when I precede it with<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">DECLARE c1 CURSOR FOR</code><hr />
</div> ...and embed it in some RPG I get a complaint about the AS not being expected.<br />
<br />
Is this another feature that only works sometimes, depending on where you're using SQL?  I guess I could just correlate the field names with the full file name and rue the day I chose such a long name!<br />
<br />
Any tips appreciated.</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>zkarj</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9550-Using-AS-to-correlate-a-table</guid>
		</item>
		<item>
			<title>quick question for counting unique order numbers</title>
			<link>http://www.code400.com/forum/showthread.php/9518-quick-question-for-counting-unique-order-numbers?goto=newpost</link>
			<pubDate>Thu, 05 Aug 2010 19:11:53 GMT</pubDate>
			<description>I have a file that contains order numbers.  Some of them are repeated.   I want to run a quick SQL to grab the count of unique order numbers in the file.    I tried this, but it says I have a syntax error: 
 
 
Code: 
--------- 
 
SELECT COUNT(*) FROM (SELECT DISTINCT ORDER# FROM FILE1) 
---------...</description>
			<content:encoded><![CDATA[<div>I have a file that contains order numbers.  Some of them are repeated.   I want to run a quick SQL to grab the count of unique order numbers in the file.    I tried this, but it says I have a syntax error:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
SELECT COUNT(*) FROM (SELECT DISTINCT ORDER# FROM FILE1)</code><hr />
</div> I know it's something simple, I just don't see it.</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>soup_dog</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9518-quick-question-for-counting-unique-order-numbers</guid>
		</item>
		<item>
			<title>SET SCHEMA in SQL stored procedure</title>
			<link>http://www.code400.com/forum/showthread.php/9509-SET-SCHEMA-in-SQL-stored-procedure?goto=newpost</link>
			<pubDate>Thu, 05 Aug 2010 05:23:59 GMT</pubDate>
			<description><![CDATA[This is driving me absolutely batty. I've spent hours searching for a solution and not found one. It relates to the following procedure: 
 
 
Code: 
--------- 
create procedure copy_user_ids                                     
(in lib char(10), fromuser char(10), touser char(10))             ...]]></description>
			<content:encoded><![CDATA[<div>This is driving me absolutely batty. I've spent hours searching for a solution and not found one. It relates to the following procedure:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">create procedure copy_user_ids&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
(in lib char(10), fromuser char(10), touser char(10))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
language sql modifies sql data&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
begin&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; SET SCHEMA = lib;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; insert into plusdf00&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; select touser, usevar, usval, usenvt, substr(SESSION_USER,1,10),<br />
&nbsp; year(now())*10000+month(now())*100+day(now()),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; hour(now())*10000+minute(now())*100+second(now())&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; from plusdf00&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; where ususid = fromuser and usenvt = 'USER_IDS';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
end</code><hr />
</div> The procedure creates just fine, but the SET SCHEMA statement appears to do absolutely nothing. No matter what I provide as a parameter value on the CALL statement, the file is never found unless it is somewhere in my library list.<br />
<br />
The SQL Reference manual clearly shows the use of SET SCHEMA within a SQL-defined stored procedure, so as far as I can tell it should work.<br />
<br />
I've tried all sorts of variations including specifying DYNDFTCOL, putting the variable as a qualifier and using *SYS versus *SQL naming conventions (which for the rest of the procedure content doesn't matter at all). Nothing changes the behaviour, though many times I made changes which stopped the procedure creating.<br />
<br />
I am utterly stuck now. All I need to do - through whatever means possible - is allow for the library name to be specified on the CALL statement on an interactive SQL command line.<br />
<br />
So much for my "this'll be a quick solution" approach to the problem. Oh, I know there are numerous ways to skin this cat, but I thought I should learn a new skill and create my first stored procedure seeing as I could easily express the solution as an SQL statement.<br />
<br />
Any help appreciated.</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>zkarj</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9509-SET-SCHEMA-in-SQL-stored-procedure</guid>
		</item>
		<item>
			<title>Need a Dynamic Insert Example</title>
			<link>http://www.code400.com/forum/showthread.php/9489-Need-a-Dynamic-Insert-Example?goto=newpost</link>
			<pubDate>Thu, 29 Jul 2010 12:35:31 GMT</pubDate>
			<description>Does anyone have one? 
 
Need to pass a Library and File name to a program and insert records into that table.  Just curious if anyone has an example...</description>
			<content:encoded><![CDATA[<div>Does anyone have one?<br />
<br />
Need to pass a Library and File name to a program and insert records into that table.  Just curious if anyone has an example...</div>

 ]]></content:encoded>
			<category domain="http://www.code400.com/forum/forumdisplay.php/6-SQL">SQL</category>
			<dc:creator>FaStOnE</dc:creator>
			<guid isPermaLink="true">http://www.code400.com/forum/showthread.php/9489-Need-a-Dynamic-Insert-Example</guid>
		</item>
	</channel>
</rss>
