Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

Linked Server - Drop Table


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!
0
doolinn
Asked:
doolinn
  • 2
2 Solutions
 
NightmanCTOCommented:
try [servername].[databasename].[dbo].[tablename]
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you cannot drop a table on a remote (linked) server.
0
 
NightmanCTOCommented:
True:

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

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now