TysonLPrice
Programmer
I trying to set something up to capture the output of a stored procedure without creating the temp table first. OPENROWSET does it but it doesn't accept parameters. Trying to use dynamic SQL I get the error:
"Cannot process the object " SET FMTONLY OFF EXEC cs_GetClaim 111144550". The OLE DB provider "SQLNCLI" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object."
This is the code:
I have permission because I can run it with a stored procedure without parameters. Does someone see what I am doing wrong?
"Cannot process the object " SET FMTONLY OFF EXEC cs_GetClaim 111144550". The OLE DB provider "SQLNCLI" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object."
This is the code:
Code:
declare @pkClaim varchar(20)
set @pkClaim = '111144550'
declare @sql varchar(1000)
set @sql = 'SELECT * INTO #TysonTemp FROM OPENROWSET(' + '''SQLNCLI''' + ',' + '''Server=devsql\tpa1;Trusted_Connection=yes;'''
+ ',' + ''' SET FMTONLY OFF EXEC cs_GetClaim ' + @pkClaim + ''') AS a;'
--print @SQL
exec (@sql)
I have permission because I can run it with a stored procedure without parameters. Does someone see what I am doing wrong?