Openrowset Error

  • I am running the below query:

    insert into dbo.data_temp -- inserting records in temp table

    SELECT * FROM OPENROWSET('SQLNCLI','Server= anyserver;Trusted_Connection=yes; Initial Catalog=anydb,"exec sp_spaceused t_backup_info")

    *data_temp has the same structure as sp_spaceused's output.

    *same query works fine is I use any select statment in place of 'exec sp_spaceused t_backup_info'

    Msg 7314, Level 16, State 1, Line 1

    The OLE DB provider "SQLNCLI" for linked server "(null)" does not contain the table "exec sp_spaceused t_backup_info". The table either does not exist or the current user does not have permissions on that table.

    Any help will be appriciated.

  • sachindiwaker (3/25/2009)


    insert into dbo.data_temp -- inserting records in temp table

    SELECT * FROM OPENROWSET('SQLNCLI','Server= anyserver;Trusted_Connection=yes; Initial Catalog=anydb,"exec sp_spaceused t_backup_info")

    have You tried to execute only the select statement?

    however, try using SET FMTONLY OFF; SET NOCOUNT ON: before the sp execution, like this:

    SELECT * FROM OPENROWSET('SQLNCLI','Server= anyserver;Trusted_Connection=yes; Initial Catalog=anydb,'SET FMTONLY OFF; SET NOCOUNT ON; exec sp_spaceused t_backup_info')

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply