473,785 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy Row Of Data From Table to Table In Same DB

Hi.

Like the title says - how do i do this?

I was given the following example:

INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A'

The above statement threw the following error:

An explicit value for the identity column in table 'TABLE2' can only
be specified when a column list is used and IDENTITY_INSERT is ON.

Then, after filling in all the column names in my above select
statement I kept getting an error to the effect that the number of
source and destination columns don't match. This is because one column
"confirm_ha sh" does not exist in the destination table, just the
source table.

could somebody show me how to get this to work?

thanks!

PS - MS SQL SERVER EXPRESS 2005

Jun 4 '07
10 17946
>Like the title says - how do i do this? .. An explicit value for the identity column in table 'TABLE2' can only be specified when a column list is used and IDENTITY_INSERT is ON. <<

Let us go back to RDBMS basics. A row models a complete fact ("John
bought a squid on 2007-05-12"). This fact should appear in one
table, one time and in one way in the entire schema. This is the
foundation of normalization.

In the old days, with punch cards, paper files, etc. we would
physically move these physical records from one physical location to
another physical location. We had redundancy and we want to get rid
of it. You want to increase it.

You should never use IDENTITY in an RDBMS; you want to have a
relational key. A key has nothing to do with the physical location of
the data in the hardware; it is based on the nature of the data being
modeled.

You entire approach is that of someone managing a 1950's paper file
system. Please read a book before you code again. If you want
stinking dirty kludges, then you can get them in Newsgroup; but being
a good RDBMS programmer will take YEARS of hard work. Be better than
that.

Jun 5 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8627
by: sbh | last post by:
I need to copy data from a table on one Oracle server to another. Scenario: Need to create a stored procedure in server a, database aa that will copy data from server b, database bb, table bbb to server a, database aa, table aaa. Let's say I have a user on server b, database bb named userB (password pw) that has rights to table bbb. Can anyone help me with the syntax - just for the connection part? Is this possible with a stored...
5
295556
by: Bill | last post by:
I have a table I'd like to copy so I can edit it and play around with the data. How do I create copy of a table in SQl Server? Thanks, Bill
1
3096
by: Steve | last post by:
ive been too busy trying to get my database and forms to work to really concern myself with backing things up or protecting the data in case a user really botches something up. is there anything like archive logging for an access database. for now is there a way I can say copy main-table into main-table-timestamp automatically when the application opens or say when a form is loaded? the database is usable at this time but there are...
1
1420
by: Otto Blomqvist | last post by:
Hello ! I have two tables with identical schema. I want to copy all data from Table A to Table B, but table B might already have some of table A:s data (each record is identified using record_numbers). I would suspect this can be accomlished using a 2 stage query, first performing a join of some kind and then the copying. But I have little to no clue on how to make it happen. Any ideas ?
3
4418
by: colleen1980 | last post by:
Hi: Can any one please help me when user select 2 dates from DDLDate1 10/09/2006 and DDLDate2 10/12/06 and the name and it close the form. I need to create multiple records in the another table on the basis of two dates like that. Data in continous form table1 ----------------------------- Data entered in continous form 10/09/2006 10/12/2006 John
2
1556
by: isa | last post by:
Hello everyone, i want to transfer/copy data from MSDE to SQL Server 2000 and from SQL Server to MSDE, through Stored Procedures , not using a "Replication", kindly tell me how i make a SP for this as both datatbases are connetec through LAN, i mean MSDE on diff machine and SQL Server on other machine i make a new registration and connect with MSDE now how can i write a SP that copy data from table of 1 Database to other table of that...
1
1316
by: romeodionisio | last post by:
How to copy data in table in a different SQL Server?.... Can anyone help me?.. Thanks....
15
17960
by: BaneMajik | last post by:
I am working with an Access 2003 inventory database. When a piece of equipment goes bad we junk it and delete it from the database. We have been copying the record to an excel form for storage just so we have a record of the former piece of equipment. I am trying to make the database more user friendly and keep all of the data in Access so have created another table called JunkedEquipment. I would like to be able to use a command button on a...
1
1850
by: okonita | last post by:
Hi all, I have a need to copy data from one database/schema to a different database schema. Yes, I can use export/import but that is not "elegant". Yes, I can try a redirected Restore from Backup but this method has the irritating requirement of pause, set tablespaces and continue, again much manual intervention. What I am most interested in is this: The two databases are in the same instance/server. I want to be able to copy directly from...
0
1294
by: Bxitty | last post by:
I have a package that works great when I run it from the SQL2000 environment. This job transfers data from SQl2005 table to a mainframe DB2 table. After I migrated the job to SQL2005 and ran it (with'n th SQL2000 desiigner editor) it fails with the message Step Error Source: Microsoft Data Transformation Services (DTS) Data Pump Step Error Description:The number of failing rows exceeds the maximum specified. Step Error code:...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.