Cannot create an instance of OLE DB provider Microsoft.Jet.OLEDB.4.0 for linked server null

I have MS Sql server 2012, and Office 2013. This seems to be very finicky, so you may have to adjust to your particular versions. Download the Microsoft.ACE.OLEDB.12.0 for Windows, 64 bit version found here: https://www.microsoft.com/en-us/download/details.aspx?id=13255 Install it on your server. Check the user running SQL Server and make sure that user has access to … Read more

Using a Variable in OPENROWSET Query

As suggested by Scott , you cannot use expressions in OPENROWSET.Try creating a dynamic sql to pass the parameters Declare @ID int Declare @sql nvarchar(max) Set @ID=1 Set @sql=”SELECT * FROM OPENROWSET( “‘SQLNCLI”, ”DRIVER={SQL Server};”, ”EXEC dbo.usp_SO @ID =’ + convert(varchar(10),@ID) + ”’)’ — Print @sql Exec(@sql)