473,396 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help needed for Update Query

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 1274
deepuv04
227 Expert 100+
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
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 Expert 100+
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
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
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
ive solved it, it needed COLLATE database_default adding to the end off the query as it seems to get in a muddle which database to look at:

SHGproperties ON SHGProperties.Prop_ID = Prop_Main.prop_propertyID COLLATE database_default
Mar 28 '08 #7

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

Similar topics

4
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...
9
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...
28
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...
6
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...
1
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...
7
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...
5
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...
5
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...
6
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...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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,...

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.