I’m looking for a way to combine different rows into a single row with columns. Let’s take this example table: Desired output: Please note that Data centers are not necessarily these three, they can be N different data centers that I will not know in advance. Answer With a known set of sourceDataC…
Tag: sql
ERROR 1062 (23000): Duplicate entry ‘2147483647’ for key ‘PRIMARY’
I have a table: As we can see, the previous value, just went wrong into table. Should be 16 numbers and not only 10, actually different numbers. When i try to insert a new value: I get this error: ERROR 1062 (23000): Duplicate entry ‘2147483647’ for key ‘PRIMARY’ If bank_card is AUTO_I…
Access UPDATE query using Regular Expressions
I have created the following Regular expression in javascript to test if the string works. which works perfectly fine. However no i have tried to convert this SQL (using the ms access sample database) i have tried the following which hasn’t worked as i get an error. which didn’t work. I think I…
SQL INSERT INTO from multiple tables
this is my table 1: this is my table 2: and now I want a table 3 which shows me all information: I tried first to insert into table 3 only the values from table 1 and then I inserted into table 3 the values from table 2 with an inner join where Id = Id is. But all I
Failing update table in db2 with SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;
I am using db2 9.5 i have created a column in table which is created successfully but i am not able to update table column and getting following error [Error] Script lines: 1-1 ————————– DB2 SQL error: SQLCODE: -668, SQLSTATE: 57016, SQLERRMC: 7;DB2ADMIN.X…
issue with derby database on where condition
Below is my table structure. create table “APP”.REGISTRATION ( “id” INT not null primary key GENERATED ALWAYS AS IDENTITY(START WITH 1,INCREMENT BY 1), “firstname” VARCHAR(50), …
Use string contains function in oracle SQL query
I’m using an Oracle database and I want to know how can I find rows in a varchar type column where the values of that column has a string which contains some character. I’m trying something like this (that’s a simple example of what I want), but it doesn’t work: I also want to know if …
How to set a connection from eclipse to SQLServer?
I am trying to connect to SQL Server from eclipse and i get the following error. I mention that i verified and the SQL Server Browser is running on the host and i have no firewall active. This is the code i’ve written: Answer First thing before DB programming. Test each “step”. Before execut…
Sql Server 2008 Update query is taking so much time
I have a table name Companies with 372370 records. And there is only one row which has CustomerNo = ‘YP20324’. I an running following query and its taking so much time I waited 5 minutes and it was still running. I couldn’t figure out where is the problem. Answer You don’t have trigger…
INSERT INTO with use CASE – sqlite?
I have a problem with syntax. I need use IF in sqlite, and I replace IF – CASE. My statement doesn’t work, I don’t know, what is wrong? Answer Assuming the default for aNew is NULL: Otherwise you’ll need to put that logic in your application code.