 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How do I INSERT records into AS400 DB2 file from SQL server?</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 17:28:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83192</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Wed, 03 Nov 2010 11:29:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-83192</guid>
		<description><![CDATA[Thank you for responding.  The code doesn&#039;t look anything like I expected, but then it&#039;s been about 6 years and a couple of versions since I worked with SQL/Server.
Phil]]></description>
		<content:encoded><![CDATA[<p>Thank you for responding.  The code doesn&#8217;t look anything like I expected, but then it&#8217;s been about 6 years and a couple of versions since I worked with SQL/Server.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83171</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 02 Nov 2010 21:01:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-83171</guid>
		<description><![CDATA[&lt;i&gt;As I said, I’m not very knowledgeable about SQL;...&lt;/i&gt;

Even more of a problem, you&#039;re not actually using &quot;SQL&quot;. You&#039;re using Microsoft&#039;s functions that do things in their own ways. There&#039;s nothing wrong with that; it just isn&#039;t quite how an INSERT would be done in standard SQL for AS/400s which tend to follow actual SQL standards much more closely in supported statements.

I&#039;m really sorry it took so much to get around to the real problems.

For future questions, begin with pasting a copy of some actual attempt at coding a solution. Add a description of the environment that includes any client and/or server operating system levels, any client/server products that might be in use for the problem, and any specific error messages. If there are message identifiers that you can see, those can be more important than the message text.

If you don&#039;t know an important detail, make sure you ask how to track it down. Learning how to find that stuff out can be more important than just getting a direct answer. (Sometimes the wrong question might be asked, so a direct answer could just put you farther down the wrong path even if the answer is totally &#039;correct&#039;.)

Nevertheless, glad something is working for you!

Tom]]></description>
		<content:encoded><![CDATA[<p><i>As I said, I’m not very knowledgeable about SQL;&#8230;</i></p>
<p>Even more of a problem, you&#8217;re not actually using &#8220;SQL&#8221;. You&#8217;re using Microsoft&#8217;s functions that do things in their own ways. There&#8217;s nothing wrong with that; it just isn&#8217;t quite how an INSERT would be done in standard SQL for AS/400s which tend to follow actual SQL standards much more closely in supported statements.</p>
<p>I&#8217;m really sorry it took so much to get around to the real problems.</p>
<p>For future questions, begin with pasting a copy of some actual attempt at coding a solution. Add a description of the environment that includes any client and/or server operating system levels, any client/server products that might be in use for the problem, and any specific error messages. If there are message identifiers that you can see, those can be more important than the message text.</p>
<p>If you don&#8217;t know an important detail, make sure you ask how to track it down. Learning how to find that stuff out can be more important than just getting a direct answer. (Sometimes the wrong question might be asked, so a direct answer could just put you farther down the wrong path even if the answer is totally &#8216;correct&#8217;.)</p>
<p>Nevertheless, glad something is working for you!</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: normap22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83165</link>
		<dc:creator>normap22</dc:creator>
		<pubDate>Tue, 02 Nov 2010 16:58:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-83165</guid>
		<description><![CDATA[&lt;b&gt;THANKS TO TOM AND PHILLIP FOR ALL OF YOUR HELP!&lt;/b&gt;

As I said, I&#039;m not very knowledgeable about SQL;  I didn&#039;t need the VALUES statement, did I?  :-)

THIS worked perfectly:
INSERT OPENQUERY (WMT400, &#039;SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM rmtlib.rmtfile&#039;)
Select	lotnum, itemnumber, datepart(mm,manufactured) as F1, datepart(dd,manufactured) as F2, datepart(YY,manufactured) as F3
from lots

Finally, I can make progress on my project!]]></description>
		<content:encoded><![CDATA[<p><b>THANKS TO TOM AND PHILLIP FOR ALL OF YOUR HELP!</b></p>
<p>As I said, I&#8217;m not very knowledgeable about SQL;  I didn&#8217;t need the VALUES statement, did I?  <img src='http://itknowledgeexchange.techtarget.com/itanswers/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>THIS worked perfectly:<br />
INSERT OPENQUERY (WMT400, &#8216;SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM rmtlib.rmtfile&#8217;)<br />
Select	lotnum, itemnumber, datepart(mm,manufactured) as F1, datepart(dd,manufactured) as F2, datepart(YY,manufactured) as F3<br />
from lots</p>
<p>Finally, I can make progress on my project!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: normap22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83163</link>
		<dc:creator>normap22</dc:creator>
		<pubDate>Tue, 02 Nov 2010 16:52:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-83163</guid>
		<description><![CDATA[Ok, I answered one question, I CAN update the 400 from SQL.  I tried this....

INSERT OPENQUERY (WMT400, &#039;SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM crpdta.frobarlot&#039;)
VALUES (&#039;A10101&#039;, &#039;B20202&#039;, 02, 22, 1963)

and inserted 1 row of static data into the AS400 file.  What I need to know is how to set up the &quot;VALUES&quot; part of my sql command.  Does this help?]]></description>
		<content:encoded><![CDATA[<p>Ok, I answered one question, I CAN update the 400 from SQL.  I tried this&#8230;.</p>
<p>INSERT OPENQUERY (WMT400, &#8216;SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM crpdta.frobarlot&#8217;)<br />
VALUES (&#8216;A10101&#8242;, &#8216;B20202&#8242;, 02, 22, 1963)</p>
<p>and inserted 1 row of static data into the AS400 file.  What I need to know is how to set up the &#8220;VALUES&#8221; part of my sql command.  Does this help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: normap22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83162</link>
		<dc:creator>normap22</dc:creator>
		<pubDate>Tue, 02 Nov 2010 16:26:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-83162</guid>
		<description><![CDATA[First of all, I really appreciate your help, I&#039;m in the dark on this!  The obvious to some people is totally obscured to others.  :-}  I am not a SQL kind of person which is why I&#039;m having so many problems.  I think I have to do something like this:
&lt;pre&gt;INSERT OPENQUERY (WMT400, &#039;SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM rmtlib.rmtfile&#039;)
VALUES (&#039;select lotnum, itemnumber, datepart(mm,manufactured) as F1, datepart(dd,manufactured) as F2, datepart(YY,manufactured) as F3
from lots&#039;)&lt;/pre&gt;
&lt;b&gt;BUT I just don&#039;t know the correct way to format the command.&lt;/b&gt;
The remote file on WMT400 is in rmtlib and is rmtfile.  The fields are rllotn=20A, rlitem=30A, rlmm=2 signed numeric, rldd=2 signed numeric, rlyy=4 signed numeric.
The SQL table is lots and has LotNum=20A, ItemNumber=30A, manufactured=datetime.  Using datepart gives me each individual piece in (I think) numeric format.
Here is my error:  Msg 213, Level 16, State 1, Line 1
Insert Error: Column name or number of supplied values does not match table definition.

I also tried the same command to a file where the remote file had RLMM, RLDD, RLYY as alpha fields and tried the command that way too.  Same error.

&lt;i&gt;One potential problem is that your connection doesn’t have properties that allow updates. Is the file journaled on your AS/400?&lt;/i&gt;
I do not know how to check the properties to see if I can do updates on the 400.  It IS journaled.

Norma]]></description>
		<content:encoded><![CDATA[<p>First of all, I really appreciate your help, I&#8217;m in the dark on this!  The obvious to some people is totally obscured to others.  :-}  I am not a SQL kind of person which is why I&#8217;m having so many problems.  I think I have to do something like this:</p>
<pre>INSERT OPENQUERY (WMT400, 'SELECT rllotn, rlitem, rlmm, rldd, rlyy FROM rmtlib.rmtfile')
VALUES ('select lotnum, itemnumber, datepart(mm,manufactured) as F1, datepart(dd,manufactured) as F2, datepart(YY,manufactured) as F3
from lots')</pre>
<p><b>BUT I just don&#8217;t know the correct way to format the command.</b><br />
The remote file on WMT400 is in rmtlib and is rmtfile.  The fields are rllotn=20A, rlitem=30A, rlmm=2 signed numeric, rldd=2 signed numeric, rlyy=4 signed numeric.<br />
The SQL table is lots and has LotNum=20A, ItemNumber=30A, manufactured=datetime.  Using datepart gives me each individual piece in (I think) numeric format.<br />
Here is my error:  Msg 213, Level 16, State 1, Line 1<br />
Insert Error: Column name or number of supplied values does not match table definition.</p>
<p>I also tried the same command to a file where the remote file had RLMM, RLDD, RLYY as alpha fields and tried the command that way too.  Same error.</p>
<p><i>One potential problem is that your connection doesn’t have properties that allow updates. Is the file journaled on your AS/400?</i><br />
I do not know how to check the properties to see if I can do updates on the 400.  It IS journaled.</p>
<p>Norma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83115</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Mon, 01 Nov 2010 23:00:09 +0000</pubDate>
		<guid isPermaLink="false">#comment-83115</guid>
		<description><![CDATA[&lt;i&gt;The big picture here is the INSERT into the file on the AS400. Taking the date out of it, how can I insert?&lt;/i&gt;

My apologies. It seemed as if the date was where your insert was getting hung up.

In that case, the question is now less clear. You do an insert by coding and executing a SQL INSERT statement.

But because that&#039;s such an obvious answer, there must be something else that you are asking about. Why isn&#039;t INSERT working for you? Are you seeing an error message? What error?

One potential problem is that your connection doesn&#039;t have properties that allow updates. Is the file journaled on your AS/400?

Tom]]></description>
		<content:encoded><![CDATA[<p><i>The big picture here is the INSERT into the file on the AS400. Taking the date out of it, how can I insert?</i></p>
<p>My apologies. It seemed as if the date was where your insert was getting hung up.</p>
<p>In that case, the question is now less clear. You do an insert by coding and executing a SQL INSERT statement.</p>
<p>But because that&#8217;s such an obvious answer, there must be something else that you are asking about. Why isn&#8217;t INSERT working for you? Are you seeing an error message? What error?</p>
<p>One potential problem is that your connection doesn&#8217;t have properties that allow updates. Is the file journaled on your AS/400?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: normap22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83103</link>
		<dc:creator>normap22</dc:creator>
		<pubDate>Mon, 01 Nov 2010 16:44:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-83103</guid>
		<description><![CDATA[The big picture here is the &lt;b&gt;INSERT&lt;/b&gt; into the file on the AS400.  Taking the date out of it, how can I insert?  I can change my date field to any field format later but right now I cannot even insert the item number.

But yes, to get the data into SQL, my AS400 date was an 8 character alpha field where 09/15/2010 was in the file as &quot;09-15-10&quot;.   I performed a cast function on the insert into the SQL table to get the date into smalldatetime format - That worked just great.

The SQL table that I&#039;m pulling from has the date in the datetime format.  I assume I&#039;ll have to do some type of convert to get it into some type of format that I can bork with.

Thnks,
Norma]]></description>
		<content:encoded><![CDATA[<p>The big picture here is the <b>INSERT</b> into the file on the AS400.  Taking the date out of it, how can I insert?  I can change my date field to any field format later but right now I cannot even insert the item number.</p>
<p>But yes, to get the data into SQL, my AS400 date was an 8 character alpha field where 09/15/2010 was in the file as &#8220;09-15-10&#8243;.   I performed a cast function on the insert into the SQL table to get the date into smalldatetime format &#8211; That worked just great.</p>
<p>The SQL table that I&#8217;m pulling from has the date in the datetime format.  I assume I&#8217;ll have to do some type of convert to get it into some type of format that I can bork with.</p>
<p>Thnks,<br />
Norma</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83071</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sun, 31 Oct 2010 08:02:57 +0000</pubDate>
		<guid isPermaLink="false">#comment-83071</guid>
		<description><![CDATA[&lt;i&gt;“mm-dd-yy” alpha field&lt;/i&gt;

Can you elaborate on that?

Phil&#039;s right. Is that actually an 8-byte character field that contains date values in that format?

Tom]]></description>
		<content:encoded><![CDATA[<p><i>“mm-dd-yy” alpha field</i></p>
<p>Can you elaborate on that?</p>
<p>Phil&#8217;s right. Is that actually an 8-byte character field that contains date values in that format?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83061</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sun, 31 Oct 2010 01:43:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-83061</guid>
		<description><![CDATA[One critical thing we need is the actualy data type of the date field on the 400 side.
When you said that you brought it in as char mm-dd-yy is that because it&#039;s a character field in the 400?
Phil]]></description>
		<content:encoded><![CDATA[<p>One critical thing we need is the actualy data type of the date field on the 400 side.<br />
When you said that you brought it in as char mm-dd-yy is that because it&#8217;s a character field in the 400?<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: normap22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-do-i-insert-records-into-as400-db2-file-from-sql-server/#comment-83031</link>
		<dc:creator>normap22</dc:creator>
		<pubDate>Fri, 29 Oct 2010 21:59:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-83031</guid>
		<description><![CDATA[Thanks TomLiotta!

AS400 = V5R4M0
SQL Server = 2005
Connection = Microsoft OLE DB Provider for ODBC Connection
Then I linked the server via SQL 2005, Server Objects, Linked Servers.

Previously, when I brought data into the sql db, I took a &quot;mm-dd-yy&quot; alpha field and used a CAST conversion to get it into my sql smalldatetime.  I am not concerned with the time at all, just the date.]]></description>
		<content:encoded><![CDATA[<p>Thanks TomLiotta!</p>
<p>AS400 = V5R4M0<br />
SQL Server = 2005<br />
Connection = Microsoft OLE DB Provider for ODBC Connection<br />
Then I linked the server via SQL 2005, Server Objects, Linked Servers.</p>
<p>Previously, when I brought data into the sql db, I took a &#8220;mm-dd-yy&#8221; alpha field and used a CAST conversion to get it into my sql smalldatetime.  I am not concerned with the time at all, just the date.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.014 seconds using memcached
Object Caching 398/401 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 20:50:37 -->