Testing rake task which updates values in a column - testing

I am trying to fill in the values of a column in a database. I need to write a test that checks that the values in the column are no longer empty. I can't seem to find the documentation for this. Does anyone know where to find the documentation?

Related

ADD Datagridview values to database

I have a datagridview that i fill and after i click on a button and all the rows goes to my database, that is working, but when i want to insert more rows and insert into the database it insert all the rows again and i just want the last ones added.
If anyone could help me i appreciate.
Can't comment so I will write here...
So if I do understand you correctly you are filling gridview sending it to database. After that you fill once more the gridview and send it but this time it also send the one already are on the gridview?
Edit/Update (after the extra info [see below comments])
You can use the SELECT statment to put only values that does not exist.
Before you start using this method/statment you need to know very well which values can be put multiple times so you will write your WHERE statment that way...
I did make a example for you check it out:
Example on DBFIDDLE
There are also another option of you doing this and it is using the IF statment. I will also make a SQLFIDDLE of this but first I need to go to the market and will edit this post with that too once I come home.

Column name or number of supplied values does not match table definition, total noob

I understand this is probably a really REALLY silly problem, but I've only just started using SQL since Monday. Originally I was using an access database and converted it to SQLExpress and now I'm getting that error. Included are some screenshots that will hopefully show you how I've messed up.
The Query
The Database in SQL Studio
When you are doing an insert in Sql you need to either provide a list of the columns you are inserting into or provide values for all columns in the table.
Since your insert is providing one value and your table has two columns you would need to provide a list containing the column for which you are providing values.
insert into Data$ (CompItemNo)
Select CompItemNo
From Kits$
where ItemNo = :ItemNo;

Retrieve results from a batch of SQL queries in Pentaho or Postgres?

I'm still relatively new to SQL and Pentaho.
I've pulled a table with two different IDs and need to run a query for each specific instance.
For example,
SELECT *
FROM Table
WHERE RecordA = 'value in column A'
AND RecordB = 'value in column B'
I need the results back, either appended to new columns in the original table or part of their own text file output.
I was initially looking at using a formula for this inside of Pentaho, but couldn't quite figure it out. Since I have the query written I threw it into Excel and got the concatenated results (so a string of 350 or so queries that I need to run). I'm just not sure how to accomplish this - I tried the Execute SQL Script inside of Pentaho but it doesn't seem to do output?
Any direction would be useful. I've searched a little but have come up short so far, possibly because I am still pretty new to this platform.
You can accomplish this behavior in a lot of ways, with a "Database Lookup" step for example, but I usually do that in a quite easy way and here is a example for your tests, I hope it helps.
The idea here is to have two Table input steps, the first one will fetch the IDs we want to look at. For example you may use a SQL query similar to note on the left. The result will be a 1 column stream of rows.
Next we have a Table Input that reads the rows received and executes it's query for each row. I'll add a screenshot with the options that I selected.
What it does is replace a placeholder '?' with the data that is received. If you need two columns use two '?' but remember that it will replace the first one with the first column and the second one with the second column
And you are good to go. Test it a couple of times and good luck.
And the config for the second table input.

SQL Server invalid column name error complaining about column long gone

EDIT: Please read my answer below first, before you decide to read and try to understand the text below. You may not find it's worth it when you see what was going on ;)
I have a weird problem: SQL Server 2008 R2 keeps complaining about an invalid column that is indeed not there anymore, but I'm not using it either!
I can't update any rows in that table anymore from within my own application, where no reference to the column can be found, because I always get this error now.
I then wanted to update straight in SSMS as a test, but when I edit the rows there, I still get this error.
What happened before: I made a column called CertcUL varchar(1), and that worked. After a while it appeared I needed it to be a varchar(30), so I edited the table design and turned it into a varchar(30).
From that moment I saw that I could only update this column when I stored 1 character. When I tried to store more, I got an error warning me about string or binary truncation. So somehow, the previous varchar(1) info was still present in the DB.
When I renamed that column to CertcUL2 or Cert_cUL, the same things kept happening! So changing the column name does not change the underlying cause. Also when just trying to add some characters straight in SSMS.
When I deleted the column, and added a new one with varchar(30) straight away, and called 'test', the same problem remained! This column still only allows me to store one character! The column was the one but last column. Making it the last column does not help either. Only when creating an new column while keeping the other column, I can have columns that behave properly.
So somehow, SQL Server saves some meta data about a column, even when it has been deleted. And does not look at the name, but rather at the order in which the columns are created.
Does anyone have an idea how this can happen, and how I can fix this besides (probably) dropping and recreating the whole table?
Thanks!
Oh my God I feel so stupid...it's a trigger that still contains this column. I just noticed it because when trying to update with an update statement. Only this way I got a proper error message, so I now know what's going on. So stupid that I didn't check the triggers! Sorry about that!
More info: I had an update trigger on this table A, that copies all current values to a history table B that contains the same columns. So I did change the length of the column CertcUL in table A, but forgot about table B. So it was very confusing to see the old column name popping up every time, and see it complianing about string truncation while my column in table A seemed just fine.
Sorry again :)

Highlighting wrong columns

I'm using Fitnesse + dbFit to verify data in one database table.
If at least one column in a record is wrong the whole record is highlighted. Do you know if Fitnesse can highlight only wrong columns ?
My table has over 100 columns and even if I get information which row is wrong I have to spend much time trying to find a column that contains wrong value.
The fitSharp version of DbFit highlights the cell in error. See http://fitsharp.github.com/