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:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old August 30th, 2004, 11:09 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
Copy update like Copy insert?

Is there a way to do an update kind of the same way you would do the copy insert such as this:

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

I want to allow a client to set pricing to entire section but each seat in a venue is set as a seperate product. Thus allowing them to create a single price for a section requires a loop.

The below code does not work of course but it gives you an idea as to what i would like to try and do. Can i accomplish this without a loop?


update products set price = @iSeatAmt
SELECT @iSeatAmt As price
From products
WHERE ((iCompanyFK = @iCompanyPk)
AND (isBaseVenueSeat = 0)
AND (cProductType = 'EventSeat'))
AND (subcatcode = @subcatcode)
AND (iTicketSectionFk = @iTicketSectionFk)

Reply With Quote
  #2  
Old September 1st, 2004, 06:03 AM
ptauwhare ptauwhare is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 19 ptauwhare User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 44 sec
Reputation Power: 0
Do you mean you want to join on another table within the update? I'm not entirly clear what you want to do but perhaps this snippet of code might help?

update P
set price = S.section_price
from product P
join section S
on P.sectionID = S.sectionID
where ((P.iCompanyFK = @iCompanyPk)
AND (P.isBaseVenueSeat = 0)
AND (P.cProductType = 'EventSeat'))
AND (P.subcatcode = @subcatcode)
AND (P.iTicketSectionFk = @iTicketSectionFk)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Copy update like Copy insert?


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