Db2 Sql Error Sqlcode=-407 Sqlstate=23502
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us sqlstate=23502 in db2 Learn more about Stack Overflow the company Business Learn more about hiring developers sqlstate 23502 postgresql or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack
Db2 Tableid
Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Inserting a row into DB2 from a
Db2 Sql Error: Sqlcode=-407, Sqlstate=23502, Sqlerrmc=*n
sub-select - NULL error up vote 4 down vote favorite I am trying to insert a row into a table, using a value that is derived from another table. Here is the SQL statement that I am trying to use: INSERT INTO NextKeyValue(KeyName, KeyValue) SELECT 'DisplayWorkItemId' AS KeyName, (MAX(work_item_display_id) + 1) AS KeyValue FROM work_item; So, I am trying to create a row in NextKeyValue that has sqlcode: -407, sqlstate: 23502 'KeyName' of 'DisplayWorkItemId' and 'KeyValue' of one more than the maximum value in work_item.work_item_display_id. The SELECT statement in the above query returns the expected result, when I run it on its own. The whole SQL query is giving me the following error, though: Error: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=75, COLNO=2, DRIVER=3.50.152 SQLState: 23502 ErrorCode: -407 What does this mean, and what is wrong with my query? sql db2 share|improve this question edited May 17 '09 at 17:29 asked May 17 '09 at 3:13 pkaeding 18.4k2173120 +1 I suggest you change the title of the question to something like "Inserting a row from sub-select - NULL error", and add "SQL" tag, since this problem is generic and not DB2-specific. –Roee Adler May 17 '09 at 5:59 good idea. I just did it. –pkaeding May 17 '09 at 17:29 add a comment| 1 Answer 1 active oldest votes up vote 10 down vote accepted The most probable explanation is that you have additional columns in NextKeyValue table that can't accept NULL values, and this INSERT statement is "trying" to put NULL in them. Is that the case by any chance? share|improve this answer a
View Site Leaders Advanced Search Forum Pentaho Users Pentaho Data Integration [Kettle] Error inserting rows in a table If this is your first visit, be sure to check out the
How To Find Table Name Using Table Id In Db2
FAQ by clicking the link above. You may have to register before you can sql0407n post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from tbspaceid the selection below. Results 1 to 5 of 5 Thread: Error inserting rows in a table Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch http://stackoverflow.com/questions/873828/inserting-a-row-into-db2-from-a-sub-select-null-error to Hybrid Mode Switch to Threaded Mode 08-11-2010,03:15 PM #1 omm View Profile View Forum Posts Private Message Senior Member Join Date Jun 2010 Posts 114 Error inserting rows in a table : Not null constraint I am trying to upload data from an excel sheet to a table. Since my target table has all the columns as not null, I have replaced all the null values with some default http://forums.pentaho.com/showthread.php?77825-Error-inserting-rows-in-a-table values using replace null value step. But still, I am getting the error below. DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=6, TABLEID=260, COLNO=1, DRIVER=3.50.152 To double check, I have kept only one row in the excel sheet and have checked the values passed in the stream after the replace null value step. Everything looks fine. I should be missing something. Could there be any chance that the error could be thrown for any other reason other than the one related to Null values? Last edited by omm; 08-12-2010 at 11:54 AM. Thanks, Om ---------------------- Spoon version -4.4.0 Reply With Quote 08-11-2010,04:54 PM #2 cboyden View Profile View Forum Posts Private Message Pentaho Developer Join Date Mar 2008 Posts 140 Things to try I have never used DB2 and Google says that -407 is a null value going into a column with a not null constraint, so... The three things I would try: 1) Replace "Table output" step with a "Dummy" step and preview it. To see what is coming out of your transformation. 2) Replicate the data using a "Row Generator" step and push data into the table to make sure there is not something strange going on with DB2 and that table. (Maybe the -407 is for
360 games PC games https://support.microsoft.com/en-us/kb/330369 Windows games Windows phone games Entertainment All Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security Internet db2 sql Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Lumia All db2 sql error Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States) Terms of use Privacy & cookies Trademarks © 2016 Microsoft