Hello SQL expert,
I need to create a table with the condition if the table already exists then the statement will not continue. How can I achieve that?
So far I have:
if (not exists (select object_id from sys.objects where object_id = OBJECT_ID(N'[dbo].[CustomersTbl]') and type = 'U')))
BEGIN
CREATE TABLE Customers
(
ID Varchar(20)
,Name (VARCHAR(100)
)
END;
The above statement continues executed after the table is created. How do I update it so the statement will not executed if the table already exists?
Thank you all