473,479 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

inserting 2 fields from 1 table to another table

6 New Member
hai all


I am using a query to insert 2 fields from my temp table( emp_attendance_temp ) to the attendance table.
insert is happening but the problem is emp_attendance tables id is set as the id of the temp tables id.

I don't want to set the ID from the temp table.
i want the Id in emp_attendance in its incremental sequence


INSERT INTO emp_attendance (employee_id,attendance_status_code) select employee_id,attendance_status_code from emp_attendance_temp
Mar 22 '08 #1
4 1337
hridya
6 New Member
hai all


I am using a query to insert 2 fields from my temp table( emp_attendance_temp ) to the attendance table.
insert is happening but the problem is emp_attendance tables id is set as the id of the temp tables id.

I don't want to set the ID from the temp table.
i want the Id in emp_attendance in its incremental sequence


INSERT INTO emp_attendance (employee_id,attendance_status_code) select employee_id,attendance_status_code from emp_attendance_temp

Heading:inserting 2 fields from 1 table to another table
Mar 22 '08 #2
ronverdonk
4,258 Recognized Expert Specialist
Can't really guess what your problem is here. But if you don't want to insert the attendance_id into the attendance table, then isn't this the statement you look for
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO emp_attendance (0,attendance_status_code) select attendance_status_code from emp_attendance_temp
  2.  
Ronald
Mar 22 '08 #3
hridya
6 New Member
oh i am sorry

the problem is with sqlyog.when i closed and restarted it works correctly


your answer given is correct(the problem was my Id was not setting correct)

thanks
Mar 23 '08 #4
ronverdonk
4,258 Recognized Expert Specialist
oh i am sorry

the problem is with sqlyog.when i closed and restarted it works correctly


your answer given is correct(the problem was my Id was not setting correct)

thanks
Glad it works correct now. See you again next time.

Ronald
Mar 23 '08 #5

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

Similar topics

14
1999
by: simon | last post by:
Hi, I have two tables Table A = {ID, Item} Table B = {ID, IDA, subItem} Where ID auto increment. INSERT INTO TABLE_A ('items') values ('a')
4
4401
by: Greg Ofiesh | last post by:
Anyone who can help, I have two tables T1 and T2. T1 has fields K1 and F2 and T2 has fields K2 and F1. F1 is the foreign key relating to K1 and F2 is the foreign key relating to K2. My...
7
3429
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
11
2665
by: pradeepss | last post by:
I am developing an application which grab a comma delimited file and inserts them into a database. but while inserting it gives me an error. the code is below. Do While Not EOF(iDrop) Line...
13
3027
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
6
11742
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
2
3052
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
2
3092
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
1
4245
by: Arli | last post by:
I have the following linked tables: tblMainPL is my main table that I need to pull the information in from. It has the following fields: Autonumber1 -PK set as autonumber Date - short date...
5
2141
by: rando1000 | last post by:
Okay, here's my situation. I need to loop through a file, inserting records based on a number field (in order) and if the character in a certain field = "##", I need to insert a blank record. ...
0
7027
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,...
0
6899
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...
0
7067
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...
1
6719
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...
0
6847
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...
0
4463
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...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
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 ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.