Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 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