Solved

From Access to SQL Server

Posted on 2000-03-23
7
176 Views
Last Modified: 2010-05-02
I have an update statement which works in Access. Now I am moving to SQL Server and  trying to modify the statement, but so far without luck. What am I doing wrong?

Here the Access statement:

 UPDATE MyTable INNER JOIN YourTable ON MyTable.ID = YourTable.ID SET MyTable.NAME = [YourTable]![NAME], MyTable.ADDRESS = [YourTable]![ ADDRESS]

Here my new modified for SQL Server statement.

UPDATE MyTable
SET MyTable.NAME = YourTable.NAME, MyTable.ADDRESS = YourTable. ADDRESS
WHERE MyTable.ID = YourTable.ID

Thanks.
0
Comment
Question by:andr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
ndb earned 50 total points
ID: 2651209
Try:

UPDATE MyTable
SET MyTable.NAME = YourTable.NAME, MyTable.ADDRESS = YourTable. ADDRESS
FROM MyTable, YourTable
WHERE MyTable.ID = YourTable.ID

0
 

Author Comment

by:andr
ID: 2653425
Thank you ndb. That worked.
The only problem I have now - when I run it in the Sql server - everything is fine, but when I am trying to run from VB it gives me message "YourTable is not an object's name".
If you have an answer I will post it as a separate question(I have 30 points left at this time).
0
 
LVL 1

Expert Comment

by:ndb
ID: 2653569
Try to use:

UPDATE MyTable
SET MyTable!NAME = YourTable!NAME, MyTable!ADDRESS = YourTable!ADDRESS
FROM MyTable, YourTable
WHERE MyTable!ID = YourTable!ID





0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:andr
ID: 2653905
No, sql server doesn't recognize this syntax.
0
 
LVL 1

Expert Comment

by:ndb
ID: 2654018
What do you use in VB to connect to your database ... ODBC or OLE DB?
0
 

Author Comment

by:andr
ID: 2654508
I use OLE DB(ADO, UID = sa, no password)
0
 

Author Comment

by:andr
ID: 2654853
I found the problem - I was connected to old database. Thans for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question