MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old August 28th, 2004, 02:20 PM
JsonTerre1 JsonTerre1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Buffalo NY, USA
Posts: 29 JsonTerre1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to JsonTerre1
Question Copy Records

I have 1 table. In that table there are thousands of records. I have an ID that is autonumbered for a unique id.

What i need to do is at any given time select as many records from that table that have a certain Forein Key in it. Take all those records and copy them back into the same table but at that time i need to change some of the values including the Forien Key and the name.

Is there a bulk way to do this without having to loop? If so can you show me.

If not can someone show me the best way to get all the records and copy them back into its own talbe with a new Forien Key and Name.

Reply With Quote
  #2  
Old August 28th, 2004, 07:57 PM
kaasu kaasu is offline
Web Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 58 kaasu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 1 m 4 sec
Reputation Power: 5
TO me it seems like a case for

Insert into yourtable
Select ...
from table.....

Reply With Quote
  #3  
Old August 30th, 2004, 12:44 PM
JsonTerre1 JsonTerre1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Buffalo NY, USA
Posts: 29 JsonTerre1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to JsonTerre1
Quote:
Originally Posted by kaasu
TO me it seems like a case for

Insert into yourtable
Select ...
from table.....


Yes that was it. I figured it out. I've done it before but it had been a while.

Thank you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Copy Records


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway