473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Insert script

How do you insert a record on the table with the same data. Only two fields differ from the existing record. And the other records must be the same as the existing on, no nulls required. The records must have same collumns but only two differ.
Feb 13 '07 #1
8 4322
How do you insert a record on the table with the same data. Only two fields differ from the existing record. And the other records must be the same as the existing on, no nulls required. The records must have same collumns but only two differ.
Is this possible? Please advice...
Feb 15 '07 #2
vreddy
1
How do you insert a record on the table with the same data. Only two fields differ from the existing record. And the other records must be the same as the existing on, no nulls required. The records must have same collumns but only two differ.
Hi,

If you have a Table called TABLE1 with Columns A1,B1,C1,D1,
you want to insert these Table A1,C1 Columns data into another Table called TABLE2, then you just insert as follows.

INSERT INTO TABLE2
SELECT A1,C1
FROM TABLE1;

Hope you get it!

Cheers,
Vinay.
Feb 15 '07 #3
Thanx Vinay!

I hope i make this simpler this time:

I have TABLE1 with column1(must remain the same on the insewrted row) , column2, column3, column4 .Want to insert into column2 and column3 values 2579,2579. On TABLE1, the other columns can be null, column2 and column3 differ from the original row.

I hope i made it clear this time.
Feb 15 '07 #4
jigs
7
You can use this -

insert into table1(col1,col2,col3,col4)
(select col1,col2.'1111','2222' from table1)

here col1 and col2 are the columns which will have the same values in the table.

1111 and 2222 are constant values which will be inserted for col3 and col4 respectively
Mar 3 '07 #5
vijaydiwakar
579 512MB
How do you insert a record on the table with the same data. Only two fields differ from the existing record. And the other records must be the same as the existing on, no nulls required. The records must have same collumns but only two differ.
give me thy tbl structure ,relations if any and some data from the tbls
Mar 3 '07 #6
Dave44
153 100+
where is the data you want to insert coming from? is it coming from table1 or some other source? how do you decide what column 1 should be (or is it always the same for every single row in the table).

columns 2 and 3 are to be the same number 2579, are these the two columns which must be different for each row?
Mar 3 '07 #7
Dave44
153 100+
You can use this -

insert into table1(col1,col2,col3,col4)
(select col1,col2.'1111','2222' from table1)

here col1 and col2 are the columns which will have the same values in the table.

1111 and 2222 are constant values which will be inserted for col3 and col4 respectively
you do realize that this will insert every row in the table again... that table will double in size each time it is ran.
Mar 3 '07 #8
you do realize that this will insert every row in the table again... that table will double in size each time it is ran.
Hi! Guys,

I apologise for not updating you, i have sorted the problem. Thanx guys for your will to help.

Regards
Nhlanhla
Mar 5 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
1
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks!...
6
by: Max | last post by:
i want to insert a predefined string in a textarea when i right click on the mouse. i need to do it in internet explorer and mozilla.
4
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I...
4
by: Sergio del Amo | last post by:
i, I have the next html page <html> <head> <script> <!-- function insertcode() { var code ="<p> blablabal babala babababab</p><h1>here comes header</h1><span>fadfafa<a...
2
by: Hervé Piedvache | last post by:
Hi, A small question ... and your opinions are well done ... I have tested one thing today ... I have a script in charge to insert a lot of files inside one of my db. I have a perl script...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
2
by: mirandacascade | last post by:
O/S: Win2K Vsn of Python: 2.4 Example: <a> <b createAnotherWhenCondition="x"> <c>text for c</c> <d>text for d</d> </b>
0
by: brianrpsgt1 | last post by:
I am attempting to insert data from a HTML form using a .psp script. I can not find how to link the data that is inserted into the form to the variables in the .psp script to then insert into the...
1
by: ghjk | last post by:
I'm having php page with validation. This is the code. <script language="javascript" src="../javascripts/validate.js"></script> <script type="text/javascript"> function valForm(){...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.