0

I am trying to do a backup of all stored procedures and tables from one database server to another. I want to get a list of stored procedures and tables that exist in the destination database so I can create a script automatically from the source server to execute against the destination server to create these stored procedures and/or tables.

I tried

SELECT * 
FROM [*DestServer*].[*database*].sys.procedures

I just get the following error:

Invalid object name 'DestServer.database.sys.procedures'

Is it even possible to obtain that list I want?

4
  • That would work, which suggests your server isn't set up as a linked server. Commented Apr 11 at 18:43
  • 1
    If the linked server didn't exist, you'd get Msg 7202 Could not find server 'DestServer' in sys.servers.. And if database didn't exist on that server, you'd get Msg 7314 The <provider> for linked server... errors. Are you sure the linked server is actually a Microsoft SQL Server? Are you sure you don't have SELECT * FROM [DestServer.database].sys.procedures? That would lead to the exact error message you're showing. Commented Apr 11 at 20:28
  • what happens if you use sys.sysobjects instead of sys.procedures Commented Apr 13 at 14:53
  • Aaron, I did the [dest server].database and it does work. Thank-you. siggemannen, your suggestion worked too. Thanks for your help. Thanks to all that replied. Commented Apr 14 at 12:55

1 Answer 1

0

In the example I'm using, my linked server is called DSSQL.

SELECT * FROM [DSSQL].[master].[sys].[objects] WHERE TYPE='P';
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.