Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create Tables using Stored Procedure

Author  Topic 

sunny_10
Yak Posting Veteran

72 Posts

Posted - 2013-03-01 : 06:00:57
Hi

I want to create tables using Stored Procedure . It should check first if tables exists or not , if not then it should create.

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-01 : 06:23:10
IF OBJECT_ID('YourTable') IS NOT NULL
BEGIN
CREATE TABLE YourTable
...
END

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2013-03-01 : 06:49:07
quote:
Originally posted by visakh16

IF OBJECT_ID('YourTable') IS NOT NULL
BEGIN
CREATE TABLE YourTable
...
END

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-01 : 07:08:28
ah..nice catch

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -