I am trying to load data into SQL server table. here is my code;
from OPENROWSET('SQLOLEDB', 'Server=(local);Trusted_Connection=yes;',
'EXEC [dbo].[sp_model1] @model = ''predict1''',
'EXEC [dbo].[sp_model2] @model1 = ''predict2''',
@q =''SELECT * FROM [tcs].[dbo].[fact_FY2019_FY2021]
where
[date] >= ''''2021-02-03 00:00:00''''
and id = 11 order by key;'''
)as a
GO
Every time i run my insert statement along with above code, i get the following error
OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "Deferred prepare could not be completed.".
Incorrect syntax near the keyword 'EXEC'.
Not sure why am i getting this error.
Any help would be appreciated.
OPENROWSETwill not be able to return multiple result set