473,836 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed for Update Query

5 New Member
Im looking for some help by a MSSQL 2000 expert.

I need to update dbo.prop_main with information from another table dbo.properties

Basically where prop_propertyID = Prop_ID in both tables

add the northings_COORD and eastings_COORD information from dbo.properties to the northings and eastings from dbo.prop_main

Can anyone help me construct this?

dbo.prop_main
prop_propertyID
northings
eastings


dbo.properties
Prop_ID
northings_COORD
eastings_COORD
Mar 27 '08 #1
6 1290
deepuv04
227 Recognized Expert New Member
Im looking for some help by a MSSQL 2000 expert.

I need to update dbo.prop_main with information from another table dbo.properties

Basically where prop_propertyID = Prop_ID in both tables

add the northings_COORD and eastings_COORD information from dbo.properties to the northings and eastings from dbo.prop_main

Can anyone help me construct this?

dbo.prop_main
prop_propertyID
northings
eastings


dbo.properties
Prop_ID
northings_COORD
eastings_COORD

Is this the query you are looking for...

Expand|Select|Wrap|Line Numbers
  1. UPDATE Prop_Main
  2. SET northings = northings + properties.northings_COORD,
  3.     eastings = eastings + properties.eastings_COORD
  4. FROM Prop_Main INNER JOIN
  5.      properties ON properties.Prop_ID = Prop_Main.prop_propertyID
  6.  
Mar 27 '08 #2
britania
5 New Member
Thanks for the reply :) it looks promising.

Will that query add the northings_COORD and eastings_COORD from the Properties table to the Prop_Main northings and eastings table columns?

The query resolves on Query Analyzer, so good so far, I have to work with live data on this one, so double checking.

so basically anywhere the ids = in both tables add the coords from properties to prop_main
Mar 27 '08 #3
deepuv04
227 Recognized Expert New Member
Thanks for the reply :) it looks promising.

Will that query add the northings_COORD and eastings_COORD from the Properties table to the Prop_Main northings and eastings table columns?

The query resolves on Query Analyzer, so good so far, I have to work with live data on this one, so double checking.

so basically anywhere the ids = in both tables add the coords from properties to prop_main
hi,
That will work.. try using some test data or
First select the live data for testing using select statement and if you feel comfortable with that you can implement on live data

thanks
Mar 27 '08 #4
britania
5 New Member
many thanks - i am going to set a test environment up...i'll let you know if im smiling!

thanks again
Mar 27 '08 #5
britania
5 New Member
Ive created a test site.

when i run the query i get this error?:

Server: Msg 446, Level 16, State 9, Line 1
Cannot resolve collation conflict for equal to operation.
Mar 28 '08 #6
britania
5 New Member
ive solved it, it needed COLLATE database_defaul t adding to the end off the query as it seems to get in a muddle which database to look at:

SHGproperties ON SHGProperties.P rop_ID = Prop_Main.prop_ propertyID COLLATE database_defaul t
Mar 28 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
10240
by: Surendra | last post by:
I have this query that I need to use in an Update statement to populate a field in the table by the value of Sq ---------------------------------------------------------------------------- Inline View Query: Select Sq from ( Select substr(to_date(End_Date,"DD-MON-YYYY"),4), End_Date, Rank() Over (Partition by substr(to_date(End_Date,"DD-MON-YYYY"),4) Order by End_Date) As Sq
9
3142
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use SUBSTRING(ProductName, 1, CHARINDEX('(', ProductName)-2). I can get this result, but I had to use several views (totally inefficient). I think this can be done in one efficient/fast query, but I can't think of one. In the case that one query is not...
28
3311
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
6
2084
by: mo | last post by:
I need to bring the ssn's into UniqueSups (supervisors) from tblNonNormalized. My inherited DB is not normalized and I find it extremely irritating due to the workarounds needed. I created tblUniqueSups by doing a select Distinct Supervisor Name. Now I need to bring in the SSNs of the Unique Sups but I can't quite get it. I tried: UPDATE UniqueSups LEFT JOIN tblNonNormalized ON UniqueSups.NAME = tblNonNormalized.SupervisorName SET...
1
1136
by: JellyMan | last post by:
I am trying to do something with an Access SQL query that I have never done. I can see how it SHOULD work in my head, but can't seem to make it work in reality. I think I have it close, but my SQL syntax must be off. What I WANT to do: I have two tables. One (tbl_hours_new) is an SQL linked table through ODBC, which reads just like any other table in Access. The second (tbl_hours_Palm1) is just a regular table. I want to be able to run...
7
2199
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
5
2001
by: Dave Smithz | last post by:
Hi there, Been working on an evolving DB program for a while now. Suddenly I have come across a situation where I need to update a table based on a group by query. For example, I have a table called "students". I need to update a field called "status" on this table for all members that have never attended a class. Class attendance is recorded by another table (which represents the many to
5
3755
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional information: Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. It occurs when I attempt to add a new record. I've stripped out much of the code, leaving the pertinent (I hope) info. ...
6
6440
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the Autoexec Macro looks like the way to go. Could someone please assist? Thank you very much! Mike
0
5578
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
0
9810
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
9654
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
10818
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
10526
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
10565
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
10237
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...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.