SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion 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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 30th, 2004, 01:29 PM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Inserting Multiple Records from One Database to Another

These are the following two tables I have:

UnitMaterial:
UnitId
MaterialId
InUnit
Training
Approval

PendingUnitMaterial
UnitId
MaterialId
InUnit

I have the following records in my PendingUnitMaterial Table:
1, 5, 0
2, 5, 1
3, 5, 1

I want to get these multiple records and insert them into my UnitMaterial Table but do not know how. I have looked at other places but the syntax is screwing me up. Any help would be greatly appreciated. Thanks

Reply With Quote
  #2  
Old July 30th, 2004, 02:54 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
The easy way is to query pendingUnitMaterial, and then loop over than and insert each one into the unitMaterial table.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old July 30th, 2004, 03:24 PM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have tried doing that and I get this error:

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'VALUES'.


Here is my code:

<cfoutput>
<cfquery name="UnitMaterial" datasource="****">
SELECT *
FROM pendingunitmaterialView
</cfquery>

<cfloop query="UnitMaterial">
<cfquery name="insertUnitMaterials" datasource="****">
INSERT INTO dbo.unitmaterialView (
UnitId,
MaterialId,
InUnit,
FacilityApproval,
RaApproval
VALUES (
#UnitMaterial.UnitId#,
#UnitMaterial.MaterialId#,
#UnitMaterial.InUnit#,
1,
1
)
</cfquery>
</cfloop>
</cfoutput>

Reply With Quote
  #4  
Old July 30th, 2004, 04:02 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
uh, you need a closing parenthesis after the last column name.

Reply With Quote
  #5  
Old July 30th, 2004, 04:51 PM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Oh wow I cant believe I didnt catch that. Sorry for the carelessness and thank you so much!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Inserting Multiple Records from One Database to Another


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 4 hosted by Hostway