I’m trying to read a pipe separated text file. First lines are “BewerberID”|”Druck”|”Druckdatum”|”HistorieID”|”Bearbeiter”|”BewZuBewGruppeID”|”Bemerkung” “12586”|”EinladungOFD.dot …
Tag: sql
Optimal way to concatenate/aggregate strings
I’m finding a way to aggregate strings from different rows into a single row. I’m looking to do this in many different places, so having a function to facilitate this would be nice. I’ve tried solutions using COALESCE and FOR XML, but they just don’t cut it for me. String aggregation w…
How to process 0000-00-00 date in jdbc MySQL query
I’m getting this exception: java.sql.SQLException: Value ‘0000-00-00’ can not be represented as java.sql.Date Originating from this code: Date internalDate = rs.getDate(idx++); Where rs is a …
Oracle date to string conversion
I have a string column COL1 when I am doing this The data in COL1 is in dd-mon-yy, eg: 27-11-89 and 89 is 1989 but the select returns it as 11/27/2089. I have to do an inner TO_DATE because if I don’t then I am getting an invalid number error (ORA-01722: invalid number) How can show 1989 instead of 2089…
SQL Like statement not working in Visual Basic
Dim strText As String = tbRefine.Text Dim sql As String = “SELECT user_name,forename,surname,game_cash,reg_group FROM tblGame WHERE user_name LIKE ‘” + strSearchText + “‘ & ‘*’” Dim dsRefine As …
PostgreSQL – repeating rows from LIMIT OFFSET
I noticed some repeating rows in a paginated recordset. When I run this query: I get: Next query: I get: Why does “foo” appear in both queries? Answer Why does “foo” appear in both queries? Because all rows that are returned have the same value for the status column. In that case the d…
SQL Copy row in a table with relations
Hope some one can help me, I would like to copy rows in same table and that table has relation to another table that I have to copy related row accordingly: Table1 I copied rows with table0Id = 3 Table1 I would like to do the same to Table2 depending to the Table1 Ids like this: Table2 Table2 As you
SQLite natural join broken?
I am just getting to know NATURAL JOIN and SQLite is not behaning as I expect. SELECT * FROM r1 NATURAL JOIN (r2 NATURAL JOIN r3); and SELECT * FROM (r1 NATURAL JOIN r2) NATURAL JOIN r3; produce …
ORA-00904 invalid identifier error
I get ORA-00904 ‘c’ invalid identifier error. What is wrong with this alias ? Answer I think you want to fetch those records having count > 1. So you can’t use Indentifier C in the WHERE clause of the same query.
SQL Server find and replace specific word in all rows of specific column
I have a table TblKit that has columns Id and Number. Id is primary key of type int and Number is varchar(50). The data in the table looks like this: I want to replace all the rows of KIT% with CH in the Number field. The desired output would look like: I have tried this update query: But it is