top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to check if table exist and if it doesnt exist create table in sql server 2008

+4 votes
565 views

how to check if table exist and if it doesnt exist create table in sql server 2008

posted May 9, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

BEGIN
IF NOT EXISTS (SELECT [ name] FROM sys.tables WHERE [name] = 'xxtable' ) then
CREATE TABLE xxtable
(
col1 INT,
col2 VARCHAR(30),
col3 VARCHAR(30),
col4 INT
);
dbms_output.put_line('Table Ceated Table');
ELSE
dbms_output.put_line('Table Already exists');
END;

answer Sep 11, 2014 by Arun Gowda
...