OPENROWSET
ad hoc remote access
What changes
- Input
- OLE DB provider connection and object or query
- Output or change
- rowset (can also be a DML target)
Syntax at a glance
OPENROWSET ( 'provider_name' , { 'datasource' ; 'user_id' ; 'password' | 'provider_string' } , { [ catalog. ] [ schema. ] object | 'query' } )
Work example
A query needs a rowset from a configured provider or external source.
Confirm the provider and source are approved. Test with a non-sensitive endpoint and avoid embedding credentials in SQL.
Check your work OPENROWSET. The source returns the documented columns and the connection uses the approved identity.
Open Microsoft Learn for full syntax, permissions, and details for your version.