?
Solved

Linked Server - Drop Table

Posted on 2006-10-21
5
Medium Priority
?
353 Views
Last Modified: 2012-05-05

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
Comment
Question by:doolinn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 17779358
try [servername].[databasename].[dbo].[tablename]
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 17779482
you cannot drop a table on a remote (linked) server.
0
 
LVL 29

Assisted Solution

by:Nightman
Nightman earned 1000 total points
ID: 17779510
True:

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

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question