Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I generate block of duplicate rows in table with one column having different value

Posted on 2008-06-15
2
Medium Priority
?
188 Views
Last Modified: 2010-04-21
I have a data table called Games in an MS SQL 2005 database with a column called CaseID. CaseID is a foreign key from another datatable called Cases. I want to select a block of rows from Games where CaseID = 1 (for example), and add them into Games with CaseID = 2 (for example). I am struggling to write the SQL query to do this. I am working in Visual Web Developer 2008 Express Edition. I am building an ASP.NET 3.5 page with code in Visual Basic.
0
Comment
Question by:jat465
2 Comments
 
LVL 51

Accepted Solution

by:
Mark Wills earned 500 total points
ID: 21789085
Not sure I understand the full questions here... but as a starting point,

select * from games where caseid = 1

will get that initial 'block'

not sure what you mean by "add them into Games" but think you then want to insert as caseid = 2 ?

insert games (caseid, col1,col2,col3,etc)
select 2, col1,col2,col3
from games where caseid = 1

If you can explain a bit more, step by step, then might be able to get closer to what you are really after...
0
 

Author Closing Comment

by:jat465
ID: 31467327
Thanks! Was exactly what I needed.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question