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:
  #1  
Old October 1st, 2004, 11:40 AM
cmv131 cmv131 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 33 cmv131 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 54 m 27 sec
Reputation Power: 5
Need Help with update

Hello, I am having a small problem with an update query.

here is what I have:

Code:
UPDATE [_SMDBA_].[_TELMASTE_] 
set [_SMDBA_].[_TELMASTE_].[SEQ_TEAM_ASSIGNMENTS] = [_SMDBA_].[CAI_TEAMMEMS].[SEQUENCE]
	FROM [_SMDBA_].[_TELMASTE_]
	inner join [_SMDBA_].[CAI_TEAMMEMS]
	ON  [_SMDBA_].[_TELMASTE_].[SENT TO] = [_SMDBA_].[CAI_TEAMMEMS].[SEQSUPPORTSTAFF]
	AND [_SMDBA_].[_TELMASTE_].[SEQ_SUPPORT_TEAM] = [_SMDBA_].[CAI_TEAMMEMS].[SEQ_SUPPORT_TEAM]
	AND [_SMDBA_].[_TELMASTE_].[Seq_Team_Assignments] is null


I am getting an error

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.


Now what I am wondering is how to even begin to fix it. It should obviously return 1 or 0 values for each row of this Telmaste table. I have used similar queries before, and am wondering what I may be missing. Any ideas or suggestions are appreciated!

Reply With Quote
  #2  
Old October 1st, 2004, 12:10 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
How many values does it return when you run that subquery that you're trying to set it to?
Probably more than one. Sounds like you need some more criteria.

Reply With Quote
  #3  
Old October 1st, 2004, 12:37 PM
cmv131 cmv131 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 33 cmv131 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 54 m 27 sec
Reputation Power: 5
It returns 1 value for each row that meets the criterea. It isn't returning any duplicate vaues or anything like that. It should look at each row and update it accordingly with those conditions. There really isn't any more critera I can use as this will need to update 2000+ records

Reply With Quote
  #4  
Old October 1st, 2004, 01:42 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,700 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 17 h 21 m 2 sec
Reputation Power: 986
let's try changing your query just a little, to use a table alias
Code:
update [_SMDBA_].[_TELMASTE_] 
   set [SEQ_TEAM_ASSIGNMENTS] = [_SMDBA_].[CAI_TEAMMEMS].[SEQUENCE]
  from [_SMDBA_].[_TELMASTE_] as foo
inner 
  join [_SMDBA_].[CAI_TEAMMEMS]
    on foo.[SENT TO] = [_SMDBA_].[CAI_TEAMMEMS].[SEQSUPPORTSTAFF]
   and foo.[SEQ_SUPPORT_TEAM] = [_SMDBA_].[CAI_TEAMMEMS].[SEQ_SUPPORT_TEAM]
   and foo.[Seq_Team_Assignments] is null
__________________
r937.com | rudy.ca

Reply With Quote
  #5  
Old October 1st, 2004, 02:03 PM
cmv131 cmv131 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 33 cmv131 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 54 m 27 sec
Reputation Power: 5
Thanks for the replay, unfortunatly it has the same result

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Need Help with update


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