Solved

Linked Server - Drop Table

Posted on 2006-10-21
5
325 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
  • 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 250 total points
ID: 17779482
you cannot drop a table on a remote (linked) server.
0
 
LVL 29

Assisted Solution

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

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

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

791 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