SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create Tables using Stored Procedure
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sunny_10
Yak Posting Veteran

63 Posts

Posted - 03/01/2013 :  06:00:57  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 03/01/2013 :  06:23:10  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
5509 Posts

Posted - 03/01/2013 :  06:49:07  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
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

India
52249 Posts

Posted - 03/01/2013 :  07:08:28  Show Profile  Reply with Quote
ah..nice catch

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000