"create if not exist" and "create table like" sql server query

sql-server, t-sql

Solution

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.

Problem

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?

Original source