Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update through openquery

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-21 : 09:37:00
Dean writes "Ok. Batter up.

It is possible through sql query to use the following statement to return data via SQL server from a linked database. ie. We are running SQL Server 2000 and have an access database empl.mdb attached as employees.

The following query works fine (am programming in vb6sp5).

dim rs as ADODB.recordset
set rs = NEW ADODB.recordset
rs.open "Select * from openquery(employees,'Select firstname, lastname, gender, title from employees where gender=''M'' ')"

THE QUESTION.
I want to write a query that will update title with "MR" for all employees who are male (gender="M"). Any ideas what that sql query would look like?

Thanks
Dean"

chadmat
The Chadinator

1974 Posts

Posted - 2002-02-21 : 11:52:27
I didn't test it, but I think this should work:

"UPDATE (employees,'Select title from employees where gender=''M'' ') SET title = 'MR'"


HTH
-Chad

Go to Top of Page
   

- Advertisement -