|
Posted by Tom Moreau on 10/02/22 11:44
Check out "linked servers" in the BOL. You can do something like:
EXEC sp_addlinkedserver
@server = 'MyLinkedServer',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'C:\MSOffice\Access\Samples\Northwind.mdb'
GO
SELECT *
FROM MyLinkedServer...Employees
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
..
"Jchick" <jchickering@gmail.com> wrote in message
news:1144454684.937047.134340@v46g2000cwv.googlegroups.com...
This outta be an easy one for someone. I have the following code in my
trigger. I am trying to connect to a DSN that is pointing to an Access
database (.mdb). However, I am not sure how to actually write the
Select From statement (see "A DSN I MADE" in the code below).
Any hints as to how I reference a DSN in the select statement?
Thanks in advance
Chick
============start of trigger===========
CREATE TRIGGER [Populate Customer Name] ON [dbo].[Invoices]
FOR INSERT, UPDATE
AS
DECLARE @InvoiceNo VARCHAR(20)
DECLARE @VendorName VARCHAR(50)
SELECT @InvoiceNo = (select InvoiceNo from inserted)
SELECT @VendorName = (select VendorName from "A DSN I MADE" where
InvoiceNo = @InvoiceNo)
Update Invoices
set VendorName = @VendorName
where F_DocumentID = (select F_DocumentID from inserted)
Navigation:
[Reply to this message]
|