How do I remove database name from SQL Server generated script?

Posted by bucha on Stack Overflow See other posts from Stack Overflow or by bucha
Published on 2010-03-19T16:39:46Z Indexed on 2010/03/19 16:41 UTC
Read the original article Hit count: 128

Filed under:
|

Anytime I use 'script table as' -> 'Insert To' (or other command), the script generated automatically places the database name in the script. Such as:

INSERT INTO [DatabaseName].[dbo].[tblToBeInserted] ...

While not a huge problem to just delete it, it has slipped by a few times and the script breaks if run on a different server with a different database name but has the same schema. (Such as running on [DatabaseName.Test])

Is there an option I can change, or can I modify the output in any way to remove this?

© Stack Overflow or respective owner

Related posts about sql

Related posts about server