473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

copying row from same table and adding value from form.request

ll
I'm working on a way to copy most data columns from another row in the
same table to a new row and insert the courseID value from the form
that executes this action (the copy). Is it possible to have both
"values" and "select" in the same Insert Into statement?
Here's what I have (below). The "CopyCourseID" is the id of the
course that is copied to the new row, although the new row will have a
different course ID ("CourseID").
---------------------------------------------------------------

strCourseID=Request.Form("CourseID")
Insert table_a(CourseID,Name,Address)
Values(strCourseID)
Select Name, Address
From table_a
Where Course ID = Request.Form("CopyCourseID")
------------------------------------------------------------------

Thanks,
Louis
Jun 27 '08 #1
2 2148
You can simply include the value in the SELECT list. A simplified
version, using constants, though you would use values from your
application.

INSERT table_a(CourseID,Name,Address)
SELECT 1234, Name, Address
FROM table_a
WHERE Course ID = 5678

Roy Harvey
Beacon Falls, CT

On Mon, 12 May 2008 12:38:51 -0700 (PDT), ll <ba**********@yahoo.com>
wrote:
>I'm working on a way to copy most data columns from another row in the
same table to a new row and insert the courseID value from the form
that executes this action (the copy). Is it possible to have both
"values" and "select" in the same Insert Into statement?
Here's what I have (below). The "CopyCourseID" is the id of the
course that is copied to the new row, although the new row will have a
different course ID ("CourseID").
---------------------------------------------------------------

strCourseID=Request.Form("CourseID")
Insert table_a(CourseID,Name,Address)
Values(strCourseID)
Select Name, Address
From table_a
Where Course ID = Request.Form("CopyCourseID")
------------------------------------------------------------------

Thanks,
Louis
Jun 27 '08 #2
ll
On May 12, 3:27 pm, "Roy Harvey (SQL Server MVP)"
<roy_har...@snet.netwrote:
You can simply include the value in the SELECT list. A simplified
version, using constants, though you would use values from your
application.

INSERT table_a(CourseID,Name,Address)
SELECT 1234, Name, Address
FROM table_a
WHERE Course ID = 5678

Roy Harvey
Beacon Falls, CT

On Mon, 12 May 2008 12:38:51 -0700 (PDT), ll <barn104_1...@yahoo.com>
wrote:
I'm working on a way to copy most data columns from another row in the
same table to a new row and insert the courseID value from the form
that executes this action (the copy). Is it possible to have both
"values" and "select" in the same Insert Into statement?
Here's what I have (below). The "CopyCourseID" is the id of the
course that is copied to the new row, although the new row will have a
different course ID ("CourseID").
---------------------------------------------------------------
strCourseID=Request.Form("CourseID")
Insert table_a(CourseID,Name,Address)
Values(strCourseID)
Select Name, Address
From table_a
Where Course ID = Request.Form("CopyCourseID")
------------------------------------------------------------------
Thanks,
Louis

Thanks so much! This worked great.
Much appreciated,
Louis
Jun 27 '08 #3

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

Similar topics

1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
1
by: Ryan McLean | last post by:
Hi everyone! What is happening is the method: sub_btnSubmitClicked is being executed every time any other object with a Handler is executed. I am trying not to use the withevents and handles...
2
by: Junior | last post by:
Hi All, I haven't got a response for this question lately and i really need to get this done ASAP. I have a .aspx page that has table two column four rows on it. 1. How do i use codebehind C#...
1
by: srneu71 | last post by:
I have a project that requires a dynamically generated matrix table. The table is setup with 4 quadrants (N,S,E,W) with checkboxes to "link" the data in adjacent quadrants. The table has to be...
7
by: Hemang Shah | last post by:
I think what i'm trying to do is passing by value. Here is the scenario: Main Form - which calls a Search form. - I pass Mainform as a reference so that I can pass data between the two. Code:...
5
by: Nirmala123 | last post by:
hi... I want to sort the table using combobox values. I give the code here. address.html: <html> <head> <title>Add a new entry</title> </head>
18
omerbutt
by: omerbutt | last post by:
AJAX PROB WITH MULTIPLE RECORDS helo iam having problem in ma code will any body look out an help, i am trying t add sale record in the database and the checkthe quantity of the part slod and...
5
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...
0
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...

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.