SQL Manager for MySQL - select inserts empty row - mysql

I have a very weird situation here. During development I discovered that one of my tables got more and more empty rows (the Id field is auto-incremented and was set). No insert statement was run from my code.
I use SQL Manager 2010 Lite for MySQL to inspect the data, and it turns out that when I Execute the select statement from there, the empty row gets added.
Has anyone else experienced this? All i do is right click the table, select 'Script to NEW SQL Editor' and Select. When I press Execute, the row gets added.

Not really an answer - I'm using phpmyadmin myself - but you could try setting one of the columns to not null? Just to see what happens, and what kind of error message you get? And you could also check to see if there are any stored procedures that could cause this.
Normally I would post this in a comment, but I don't have enough rep to do that yet, sorry...

Related

quirks with mysql workbench table editor data updates?

I've noticed some quirks with MySQL Workbench when I try to update table data directly through the MSW table editor. One example is that I have a table with a BIT column. If I change the value from 0 to 1 or from 1 to 0 and then click the Apply button, MSW opens a dialog with the Update SQL to be executed. When I click the OK button to execute the auto-generated SQL, MSW reports that the update SQL statement is invalid.
When I take a look at the generated SQL, the problem is that MySQL wraps the updated BIT value in quotes. So obviously that's a type mismatch. Any idea why I might be experiencing this quirk in MSW? This seems like a pretty straightforward use case for a mature technology?

Converting SQL server query to its equivalent MySQL for trigger

In SQL Server, we can get the last inserted record using inserted table in triggers. I know the equivalent MySQL statement is NEW. But the question is how to implement that.
A snippet is attached herewith what it shows in SQL Server. I want the very same thing in MySQL. Will it be possible to do that?
I want the output as:
Please give the total implementation. I've tried NEW in different ways those didn't work out.
Thanks.

SSIS missing data from SQL table using Fast Load

I have a bit of a problem. When I set up a SSIS package and i fire it off it shows me the amount of rows that is going into the SQL table, but when I query the table there is almost 40000 rows missing from what the last count was after the conditional split that I have in the package.
What causes this problem? Even if I have it on normal table or view it still does the same thing. But here I have to use the fastload option as it is a lot of source files being loaded. This is only testing before sending it to production and I am stuck at the moment. Is there a way I can work around this problem and get all the data that is supposed to be pumped into the table. please also take note that in the conditional split it removes any NULL values as seen in first picture.
Check the Error Output (under Connection Manager and Mappings) within Destination Component. If the Error setting is set to Ignore Failure or Redirect Row, the component will succeed, but only the successful rows will be inserted.
What is the data source? Try checking your data and make sure you don't have any terminators stored in one of the rows.

DatabaseLookup hangs on specific values

I use Kettle for some transformations and ran into a problem:
For one specific row, my DatabaseLookup step hangs. It just doesn't give a result. Trying to stop the transformation results in a never ending "Halting" for the lookup step.
The value given is nothing complicated at all, neither it is different from all other rows/values. It just won't continue.
Doing the same query in the database directly or in a different database tool (e.g. SQuirreL), it works.
I use Kettle/Spoon 4.1, the database is MySQL 5.5.10. It happens with Connector/J 5.1.14 and the one bundled with spoon.
The step initializes flawlessly (it even works for other rows) and I have no idea why it fails. No error message in the Spoon logs, nothing on the console/shell.
weird. Whats the table type? is it myisam? Does your transform also perform updates to the same table? maybe you are locking the table inadvertantly at the same time somehow?
Or maybe it's a mysql 5.5 thing.. But ive used this step extensively with mysql 5.0 and pdi 4.everything and it's always been fine... maybe post the transform?
I just found the culprit:
The lookup takes as a result the id field and gave it a new name, PERSON_ID. This FAILS in some cases! The resulting lookup/prepared statement was something like
select id as PERSON_ID FROM table WHERE ...
SOLUTION:
Don't use underscore in the "New name" for the field! With a new name of PERSONID everything works flawlessly for ALL rows!
Stupid error ...

Access query not working?

I remember using a query like this which worked for me before. But now its giving me a compile error.
I am trying to get only the first 3 characters of the second field.
select field1, left(field2, 3) from table1;
What am I doing wrong?
See this link:
http://www.techonthenet.com/access/questions/compile_error.php
It says you can get a compile error when using Left() if you have a broken reference. It also says how to fix it.
There is nothing wrong with your SQL statement. Brackets around field name, semicolon at end of statement, fewer than 3 characters in field2 --- those are all non-issues here.
There is something wrong with your database or your machine and/or its Access installation. Ordinarily I would suspect a references problem because your error is a classic symptom. However, in a comment, you indicated references are OK.
Create a new empty database and import table1 into it. Try your query in the new database. If it works there, you know the problem is limited to the original database. If the query does not work in the new database, copy the database to another machine which has Access installed and try it there. If it works on another machine, but not yours, ... I hope there is some way to repair your original machine without re-installing Office.
What happens in Access if you hit Ctrl-G on the keyboard and in the immediate window type "?Left("123Text", 3)" and hit ENTER? If you get the same compile error, then you have either a missing reference, or a compile error in your database.
To troubleshoot this, while in the VBE window, go to the DEBUG menu and select the first choice, COMPILE [project name]. You will likely receive notification of a compile error, and it should direct you to the problem that you need to fix.
Try putting the field name in square brackets
select field1, Left([field2], 3) from table1;
I don't see anything wrong with your SQL as long as your table names and column names are correct. Depending on your SQL editor or code, you may need to remove the semi colon from the statement.