Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 8th, 2003, 04:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update query equivalent in SQL

Two questions:

1. What is the equivalent of an Access Update Query in MS SQL using Access 2002 in an .ADP (not .MDB)?

I have been working with Access since it first came out and can do a lot with its queries, but now that I am working with MS SQL as the back end and Access 2002 .ADP as the front end, most of what I know seems useless.

What I am trying to do (for starters since I have a lot more to do) is update a field in one table with the corresponding field in another table. Here is the Access SQL:

UPDATE [T-Parameter] INNER JOIN [T-SetupSheetParametersDetail] ON [T-Parameter].ParameterID = [T-SetupSheetParametersDetail].ParameterID SET [T-SetupSheetParametersDetail].ListOrder = [T-Parameter].[ListORder];

But when I use any of the design tools in Access 2002 (.ADP) I don’t see how to even make an update query using the query design tools, the closest I got was to make an update SP with only one table in it and since I need two tables that is not going to work.

2. Can anyone suggest a good book, web site, etc. on query structure or MS SQL syntax specifically for programs going from the Jet to MS SQL as the back end and Access still as the front end. The difference in these queries is really going to kill me!

Thanks!

Michael
__________________
Mitch
Reply With Quote
  #2 (permalink)  
Old October 8th, 2003, 04:49 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Mitch,

I haven't worked with Access to MSSQL, but I know my SQL so I'll take a stab at helping you.

Here's MSSQL query structure that should work for you:

UPDATE [T-SetupSheetParametersDetail]
SET [T-SetupSheetParametersDetail].ListOrder = [T-Parameter].[ListORder]
FROM [T-Parameter]
WHERE [T-Parameter].ParameterID = [T-SetupSheetParametersDetail].ParameterID ;

These kinds of queries always confuse me so I imagine it's particularly harder when you are used to doing it a whole other way.

Peter
Reply With Quote
  #3 (permalink)  
Old October 9th, 2003, 08:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: South Bend, Indiana, USA.
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter, that did the work.

But I wish I had a better handle of how to use the new Access 2002 query design tools. From what I see now, they don't give me much help except for simple queries, no "Action" queries seem to be supported. That is really going to slow me down!

Thanks for your help.
Reply With Quote
  #4 (permalink)  
Old May 4th, 2005, 09:45 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried your query snippet, but it does not work in my Access. I of course changed the table names and fields appropriately. I always get a syntax error and it highlights on the word "FROM". Here is my update query.

UPDATE tblExpDemo
SET tblExpDemo.Company = dbo_ClinicPlantView.ClinicID
FROM tblClinics dbo_ClinicPlantView
WHERE dbo_ClinicPlantView.EmployerName = tblExpDemo.UDF1 AND dbo_ClinicPlantView.PlantLocation = tblExpDemo.UDF2 AND
dbo_ClinicPlantView.PlantNumber = tblExpDemo.UDF3;

Any help would be appreciated.

Dave

Reply With Quote
  #5 (permalink)  
Old May 4th, 2005, 09:47 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried your query snippet, but it does not work in my Access. I of course changed the table names and fields appropriately. I always get a syntax error and it highlights on the word "FROM". Here is my update query.

UPDATE tblExpDemo
SET tblExpDemo.Company = dbo_ClinicPlantView.ClinicID
FROM tblClinics dbo_ClinicPlantView
WHERE dbo_ClinicPlantView.EmployerName = tblExpDemo.UDF1 AND dbo_ClinicPlantView.PlantLocation = tblExpDemo.UDF2 AND
dbo_ClinicPlantView.PlantNumber = tblExpDemo.UDF3;

Any help would be appreciated.

Dave
Reply With Quote
  #6 (permalink)  
Old May 5th, 2005, 05:14 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Norway.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You may not have a space in your table name:

Code:
FROM  tblClinics dbo_ClinicPlantView
Gert

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Update query (error message) Neal SQL Server 2000 1 August 3rd, 2007 08:57 PM
Ampersand SQL equivalent Coby Access VBA 1 May 4th, 2007 06:25 AM
Update table using SQL query from form pater53 Access VBA 4 January 24th, 2007 11:24 AM
SQL Update query morne Access 11 December 17th, 2004 01:47 PM
SQL "like" equivalent in XSLT AForgue XSLT 5 December 4th, 2003 02:11 AM



All times are GMT -4. The time now is 02:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.