how can i create a table just if that table is not exist. in my case, i want to create table with this query :
SELECT *
INTO a
FROM b
that table a in db A and table b in db B. any help?
if not exists (select [name] from sys.tables where [name] = 'a') SELECT *
INTO A.dbo.a
FROM B.dbo.b
you can try this .. its simple one.
You can use the OBJECT_ID function for SQL Server.
IF OBJECT_ID('a') IS NULL
SELECT *
INTO a
FROM b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With