Solved

From Access to SQL Server

Posted on 2000-03-23
7
168 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
  • 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now