top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+4 votes
121 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 Google+ Share Button LinkedIn Share Button Multiple Social 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...