473,652 Members | 3,049 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 1493
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
11020
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. I can do this with DTS but wanted a script I could email to a user to run in Query Analyzer. Example: Copy entire table called 'Customers' in the 'Data01' database to table 'Customers' in the 'Data02' database I want to overwrite all data...
3
9538
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 price information from the control(list/textarea/table). Which is the best way? Quite urgent.. pls let me know. TIA, cv
3
8355
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 recordsource is also based on a table (TblB). SubFrmC's recordsource is also based on a table (TblC). There is a one-to-many relationship between TblA (one) and TblB (many).
3
3210
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. The PK (ProductID) for each record on the form is an AUTONUMBER. This form also has a sub-form, linked via ProductID. The subform also
1
6663
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 a database with one table (dept) and identical colums as the dataset. But i can't figure out how to get the dataset into the database.
7
11613
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 is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
5
2915
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. Occasionaly, about once in 7 or 9, the lines are copied to the file out of the order they were inserted in the table. The lines have one only column of the type text.
4
2471
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 PVS.myWS.Loader(); DataSet wsDS=load.WsLoad(); dataGrid1.DataSource=wsDS; string strConn = ConfigurationSettings.AppSettings;
2
3461
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 code that will successfully copy a record and append the information to a new record in the same table (parent table) within a form. However, there are related child tables with primary keys (set to Autonumber) stored in sub-forms. That information...
4
1538
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 table inside a .mdb file. so i can't use "FILECOPY(sOURCE,DESTINATION)". Eg: if the path is "c:\Programs\data.mdb" ,then Emp is one of the table inside that data.mdb. and i don't need to delete entire data.mdb, i need to delete only that "Emp" table...
0
8367
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...
0
8811
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
8703
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
7302
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
6160
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
5619
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
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
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
1
1914
muto222
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.