OPENDATASOURCE
ad hoc remote access
What changes
- Input
- ad hoc OLE DB connection string
- Output or change
- four-part-name source on a remote provider
Syntax at a glance
OPENDATASOURCE ( 'provider_name', 'init_string' )
Work example
A query needs a temporary external source definition for a reviewed read.
Confirm the provider string and identity with the source owner. Keep secrets outside the query text and test against a safe fixture.
Check your work OPENDATASOURCE. The remote object resolves through the approved provider and no credential appears in the script.
Open Microsoft Learn for full syntax, permissions, and details for your version.