Solved

From Access to SQL Server

Posted on 2000-03-23
7
170 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA loop through headers using value 3 57
DIR issue 7 51
Vb.net 2008 2 56
Specify ip address in my connection string for sas 2 54
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 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

17 Experts available now in Live!

Get 1:1 Help Now