Linked Server - Drop Table

doolinn
doolinn used Ask the Experts™
on

I get the error "The object name 'txtsrv...test#txt' contains more than the maximum number of prefixes. The maximum is 2" when i run the following:-

DECLARE @table nvarchar(1000)
DECLARE @SQL nvarchar (1000)
SELECT @SQL = ' txtsrv...[test#txt]'
SELECT @table = 'DROP TABLE' + @SQL
EXEC sp_executeSQL @table

What do I need to change in order to delete the file?

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
try [servername].[databasename].[dbo].[tablename]
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
you cannot drop a table on a remote (linked) server.
Commented:
True:

use
EXEC  [servername].[databasename].[dbo].[sp_executesql] N'drop table tableName'

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial