I am using SQL Server 2012 and I have the following T-SQL query:
USE MyDatabase
INSERT INTO [Table1]
SELECT *
FROM [xxx.xx.x.xx].[xxx].[dbo].[Table1]
I would like to modify this query so that it copies Table1
into MyDatabase
only if that table does not already exist in MyDatabase
.
I've had a look here but I can't figure out how to migrate the solutions into my problem: Check if table exists in SQL Server
How can I achieve this?