473,503 Members | 6,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy and add the data into the table

15 New Member
Hello, I have problem. I want to copy the data from the table and add it to another table. This is simple, But the problem is that the I want to copy as well as add the data from variables into table. i.e.
strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "

In SubProj, I want to add in Project field not from the other table but from the variable called pNumber. Can somebody help me.. Thanks in advance
Oct 1 '07 #1
2 1489
ahmadbaseet
15 New Member
please help me. it is urgent
Oct 1 '07 #2
kjworm
26 New Member
Hello, I have problem. I want to copy the data from the table and add it to another table. This is simple, But the problem is that the I want to copy as well as add the data from variables into table. i.e.
strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "

In SubProj, I want to add in Project field not from the other table but from the variable called pNumber. Can somebody help me.. Thanks in advance
Try:

Expand|Select|Wrap|Line Numbers
  1. strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT "& pNumber &" , SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "
  2.  
This is for if your pNumber is calculated in the code
or
Expand|Select|Wrap|Line Numbers
  1. strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT "& [pNumber] &" , SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "
  2.  
This is for if you pNumber is on your form or whatever.
Oct 1 '07 #3

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

Similar topics

1
10974
by: sqlnewbie | last post by:
I'm a newbie to script writing. I'm trying to write a script to copy all data from a table to the same table in a 2nd database. Both databases are on the same server and are identical in design. ...
3
9532
by: cv | last post by:
Hi all, I have to copy two set of data from 2 files(notepad/excel) say, products and their corresponding prices to list/textarea/table. I should be able to retrieve the product and corresponding...
3
8337
by: Tlm | last post by:
Hello All, I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also has a subform embedded in it (SubFrmC) The form's recordsource is based on a table (TblA). SubFrmB's...
3
3196
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
1
6657
by: Jeroen Pot | last post by:
Hi, I have a dataset "Mydataset" which contains of a few fields. (lets say dept_id and dept_name) A user can select several of these, and i want to export this to an access database. I have...
7
11600
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
5
2897
by: Clodoaldo Pinto Neto | last post by:
Hello, How to make sure COPY TO writes the table lines to the file in the same order they were inserted? I'm producing html pages in pl/pgsql and using COPY TO to write then to file....
4
2461
by: JIM.H. | last post by:
Hello, I am trying to write the data I got from a web service to my table in SQL Server I need to append the dataset wsDS to the dataset ds and do update. PVS.myWS.Loader load = new...
2
3445
by: Swinky | last post by:
I hope someone can help...I feel like I'm walking in the dark without a flashlight (I'm NOT a programmer but have been called to task to do some work in Access that is above my head). I have...
4
1530
by: remya1000 | last post by:
i'm using VB.NET i have 4 computers in network. when i press a button i need to delete a table from computer 2,3,4 and i need to copy that table from computer 1 to 2,3,4. and this file is a...
0
7194
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
7070
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
7267
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,...
0
7316
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
6976
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...
1
4993
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...
0
4666
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
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
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 ...

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.