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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Create Schema

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2008-02-26 : 10:51:39
what wrong ?

IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE [name] = 'ATypes' )
BEGIN
CREATE SCHEMA [ATypes] AUTHORIZATION Owner_SchATypes;
END
GO

why I get an error ?


Noam Graizer

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-26 : 11:03:23
It should be like this:

IF EXISTS ( SELECT * FROM sys.schemas WHERE [name] = 'ATypes' )
DROP SCHEMA [ATypes]
GO

CREATE SCHEMA [ATypes] AUTHORIZATION Owner_SchATypes
GO

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2008-02-26 : 11:10:43
so, I get this error:

Msg 3729, Level 16, State 1, Line 2
Cannot drop schema 'ATypes' because it is being referenced by object ...


Noam Graizer
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-02-26 : 11:37:19
It looks like you already have that schema.
Check in Schema.
Go to Top of Page
   

- Advertisement -