Questions tagged [select-insert]
28 questions
0
votes
3 answers
How to execute an INSERT that's in a SELECT statement?
for my DB course i have a table: lab4Central which columns are: productid, description and plantid,
The plant QRO has and id = 1000, an example: 12799, 'Product 12799', 1000.
and the plant SLP has an id = 2000, ex: 29665, 'Product 29665', 2000.
I…

Zeta Zav
- 5
- 3
0
votes
1 answer
How to select data from server and insert it into another server in informix DB
If i have two tables with the same structure Table1,Table2 in different databases DB1,DB2 in two different servers S1 And S2.
How to Select from Table1 and Insert Into Table2 with a simple query ?
I try to execute the following but in vain:
INSERT…

Anyname Donotcare
- 11,113
- 66
- 219
- 392
0
votes
1 answer
Concat NULL with Varchar SQL Server 2008
I would like to ask how can I concatenate a nvarchar column with NULL without getting NULL? I would like to create an INSERT script using SELECT, but when any of the values is NULL, I get only NULL.
SELECT TOP 10
'IF NOT EXISTS(SELECT 1 FROM…

Nogi
- 134
- 9
0
votes
2 answers
System.Data.SqlClient.SqlException: String or binary data would be truncated
I am creating a web app in which I am executing a select command on my stored procedure, but I want to insert the same fetched data into another table.
So I tried to do something like the following
CREATE PROCEDURE profinalinstexpensesonid
…
user6656728
0
votes
2 answers
Insert into table data fetched by stored procedure
I have a stored procedure which is fetching data from different tables with the help of joins.
Here is how it looks
ALTER PROCEDURE profinalinstexpensesonid
(@from varchar(50),
@to varchar(50),
@trainer varchar(50),
@sonvinid…
user6882159
0
votes
1 answer
MySQL contradiction insert
I am trying to insert into one of my tables (from the same table). I need to change 1 of the values, so I tried to insert with select as answered here.
I have an auto increment pk, and would want the newly inserted pk to continue the count. so…

Nina
- 99
- 12
0
votes
3 answers
Counting a cell up per Objects
i got a problem once again :D
a little info first:
im trying to copy data from one table to an other table(structure is the same).
now one cell needs to be incremented, beginns per group at 1 (just like a histroy).
i have this table:
create table…

domiSchenk
- 880
- 4
- 23
- 41
0
votes
1 answer
MariaDB INSERT value as COLUMN_CREATE (dynamic column)
I need insert dynamic column as select from another table.
I tried:
INSERT INTO table (id, photos)
VALUES
(12345,COLUMN_CREATE(SELECT file FROM photo WHERE ad_id = 12345));
and
INSERT INTO table (id, photos)
VALUES
(12345,SELECT COLUMN_CREATE(file)…

Ondřej Machala
- 133
- 1
- 6
0
votes
2 answers
How to insert selected data from a table into another table using php?
I want to insert selected data from one of my table under the same database. I have a code but it doesn't work.
moduleindex.php

Jeff
- 19
- 8
0
votes
1 answer
How to use dynamic value of table column in the value of another column on INSERT
I'm doing something like the below..
INSERT INTO example_table
(start_time,
start_time_type,
end_time,
end_time_type,
duration)
SELECT IF(start_time_type = 'now'
OR…

Brett
- 19,449
- 54
- 157
- 290
0
votes
2 answers
How do I take SELECTed output and write it to a new TABLE in MySQL?
Possible Duplicate:
Insert data from to a table
From the main Tax table, I want to be able to do a computation and write the output into a new table.
select zipcode, sum(A00100)/sum(N1) as 'avg_agi' from taxbyzip2008 group by zipcode;
The new…

Edward
- 9,430
- 19
- 48
- 71
0
votes
2 answers
Select Inside Insert Statement - MySQL Cursors
I tried some, but I couldn't find the solution, somehow I managed to get this result.
Here is the query:
DELIMITER ##
CREATE PROCEDURE test1(start_date DATE,end_date DATE)
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE a INT;
DECLARE…

Praveen Kumar
- 89
- 3
- 13
-1
votes
1 answer
How can I join data from two tables and insert the result into a new table?
I have a table for my products and my key is Pid.
Each product can have several types of modes that are registered in the table TB_Types.
did is an identity column (key), pid is foreign key to products…

hamo
- 39
- 8