473,611 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to copy field values between fields with different names.

1 New Member
hi there,

i have a problem i hope someone can help with

i have 2 tables, and i want to populate table 1 with data from table 2

in table one i have a filed called usern and in table 2 i have a feild called username -

i want to move the usernames from table 2 into table 1 but the field name is different -

can someone help?
Jun 9 '07 #1
2 4412
jaxpylon
4 New Member
It might be possible to do it using a column alias:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE table2 SELECT *, usern AS username FROM table1;
Else, you can do it in two transactions:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE table2 SELECT * FROM table1;
  2.  
  3. ALTER TABLE table2 RENAME COLUMN usern to username;
Jun 10 '07 #2
Motoma
3,237 Recognized Expert Specialist
Another way to do this would be:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO TableOne (Username, Password, Email) (SELECT usern, passw, emailaddress FROM TableTwo)
  2.  
Jun 11 '07 #3

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

Similar topics

4
2221
by: Michael Flanagan | last post by:
(Bottom line: I think what I'm looking for is an easy way of changing the case of key values in an array.) I've got code that I'm trying to make agnostic about the underlying database system I'm using. That is, I want the code to work whether the underlying db is MS SQL, MySQL, Oracle, etc. I'm using the PEAR DB package, and it's great for what I'm trying to do...except in one area. I get the returned row fields in an associative array,...
42
5750
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same kind. It sounds simple but evidently .NET has difficulty with this concept for some reason. I do understand that .NET objects are created on the GC heap but that doesn't mean that they couldn't be copied from another object of the same kind when...
8
7090
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: BattID VehicleID STDATE STTIME CTC LKO500HF 00000000 10/27/2003 4:13:51 AM 4 LKO500HF 00000000 10/27/2003 5:13:51 AM 5 LKO500HF 00000000 10/27/2003 10:13:51 AM 6 LKO500HF 00000000 10/27/2003 11:13:51 AM 4
4
12832
by: Gene | last post by:
When entering a record in a form, I would like a value in a field of the previous record to be entered automatically into a different field of the current record. Which way should I go? Is it also possible to do this based on criteria from the previous record?
1
2558
by: Sean Howard | last post by:
Dear All, As is my want I need to do something in Access that seems simple but cannot fathom out. I have main form with two subforms, both datasheets with an almost identical table structure. I want to add the functionality to copy records from subformA to subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
6
1744
by: HD | last post by:
Hello. For the following, I would appreciate if anyone could tell me: if it can be done, how it might done, and/or what search terms I could use to find the solution myself. I would like to create a database in which _adding a new record automatically creates a new field in the table_ (ideally, deleting a record would also delete the field that was created when that record was added). Thus, the number of fields in the table would...
18
18348
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
2
1800
by: Tim Vadnais | last post by:
Hi, My boss wants to add some logging functionality to some of our tables on update/delete/insert. I need to log who, when, table_name, field name, original value and new value for each record, but only logging modified fields, and he wants me to do this wing postgres pgSQL triggers. We are given 10 automatically created variables. Some of which I know I can use: NEW, OLD, TG_WHEN, TG_OP and TG_RELNAME. I can use these to get...
7
12935
by: Tizzah | last post by:
What is wrong with that? regex = /^(http|https):\/\/+({1}+)*\.{2,5}(({1,5})?\/.*)?$/ if(field.hpage.value != regex.test(field.hpage.value)){ alert("Bad Homepage") field.hpage.focus() field.hpage.select() return false
7
4983
by: Eric | last post by:
I want to open up 2 record sets. Then, copy everything from one record set to another (excluding a few fields). Is this possible? I need to exclude my primary key, and fields starting with "TMP_". I'm trying this, but it's saying ADODB.Recordset error '800a0c93' Operation is not allowed in this context.
0
8097
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8596
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8561
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8411
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6072
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
5527
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
4108
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2546
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
0
1411
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.