473,796 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subqurey returns more than one value error HELP....

My update query updates about 50 columns and they all have the same
format: (Im using ADP to interact with the SQL Server)

UPDATE dbo.GIS_EVENTS_ TEMP
SET VEH1TYPE =
(SELECT VEHICLETYPE
FROM VEHICLE AS A
WHERE(GIS_EVENT S_TEMP.CASEID = A.CRASHNUMBER) AND(A.UNITID = 1)),

VEH2TYPE = (....... same as above with UNITID = 2)
VEH1DAM = (Same format different tables...)
..
..
n

The problem is that it's part of an import process that is dependent on
data from an outside source which come once a month.
I found an error in one of the tables (a duplicate ID) which should not
be in the table this is causeing the "Subqurey returns more than one
value" error.

How can I guard against this..? If possible I would like it to only
return the first value..

I tried "COALESCE" but I couldn't get it to work I also tried "SELECT
DISTINCT"....

Any Ideas would be great.....

Jul 23 '05 #1
7 1448
AK
you might want to impose a unique index on (CRASHNUMBER,UN ITID) and
clean up your data

you might also try

UPDATE dbo.GIS_EVENTS_ TEMP
SET VEH1TYPE =
(SELECT MIN(VEHICLETYPE )
FROM VEHICLE AS A
WHERE(GIS_EVENT S_TEMP.CASEID = A.CRASHNUMBER) AND(A.UNITID = 1)),

so that it can work act as if the data were clean

BTW, GIS_EVENTS_TEMP violates 1NF

Jul 23 '05 #2
Worked great.... :)
I Know it does.. but I have a good reason...lol
The data comes in as a ralational structure with 16 tables. The data
needs to be used in a GIS enviorment which is very slow with
relationships. Sooo i'm taking the relational structure archiving it
and creating a flat file structure for the GIS.

Jul 23 '05 #3
AK
yet the fact that at least one of the subqueries blew up might indicate
that there is a problem with your data. For instanse, if there are 2
rows with the same (CRASHNUMBER,UN ITID), it is dirty data, is it not?

Jul 23 '05 #4
Yes you are correct...it is dirty data. But it is the data that the
clients are getting and I can't change that. So I'm working within the
constraints of the data I have to work with. I could try to clean the
16 tables when I import them into the DB but it 'should' come to me
clean... but your right its not? I need a DB washer

Jul 23 '05 #5
> [...] I need a DB washer

You also need a database that can keep itself clean: i.e. create unique
constraints, normalize the tables, create foreign keys and check
constraints... and after you do a one-time cleaning of the existing
data, you won't need a DB washer anymore.

Razvan

Jul 23 '05 #6
AK
yes, that's understandable. I've been in your boots more then once.
unfortunately, the cleanliness of the data is frequently determined by
political decisions rather than technical ones

Jul 23 '05 #7
YuP..Yup..Thank s for the help.......AK

Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8903
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns a empty value instead of returning the browser type. Here is the line which i am using in my code and from manual: <?php echo $_SERVER; ?>
2
1817
by: leo2100 | last post by:
Hi, I need help with this program. The program is supposed to take a text file and identify the words in it, then it should print them and count how many times a word is repeated. At first main called the function wordcount, and then the function did everything including printing out the results. That worked. Now I want to make the function return an array of pointers to struct palabra so the calling function can manage the data as it...
1
3725
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
3
2821
by: squeek | last post by:
what i need help with determining functions how to word them and variables to consider A resistor is a circuit device designed to have a specific resistance value between its ends. Resistance values are expressed in ohms or kilo-ohms. Resistors are frequently marked with colored bands that encode their resistance values. The first two bands from the left are digits, and the third is a power-of-ten multiplier.
7
9717
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
10
2091
by: satan | last post by:
I need the definitions of the method copyQueue, the default constructor, and the copy constructor folr the class LinkedQueueClass. This is what i get so far public abstract class DataElement { public abstract boolean equals(DataElement otherElement); //Method to determine whether two objects contain the //same data. //Postcondition: Returns true if this object contains the
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
2
2000
Dormilich
by: Dormilich | last post by:
Hi, I'm testing my classes for a web page and I stumble upon an error I don't have a clue what it means: Error: Fatal error: Can't use method return value in write context in "output.php" on line 142 (line 12 in snippet) the error is caused by this call: empty($inSeite_inp->getValue('PAR_NAME')) method definition see second snippet, lines 142 to 166
2
3767
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error when i do the following. if you add a contact with up to 13 fields it will be stored in a data structure. i have a tabbed pane that will show six of the 13 fields for that contact. when you double click the contact i want it to pop up and show all 13...
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.