Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2003, 04:39 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old October 8th, 2003, 04:49 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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
 
Old October 9th, 2003, 08:57 AM
Friend of Wrox
 
Join Date: Jun 2003
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.
 
Old May 4th, 2005, 09:45 AM
Registered User
 
Join Date: May 2005
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

 
Old May 4th, 2005, 09:47 AM
Registered User
 
Join Date: May 2005
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
 
Old May 5th, 2005, 05:14 AM
Authorized User
 
Join Date: Jun 2003
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






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





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