Posted by John Bell on 12/29/06 18:14
Hi
"fireball" <fireball@onet.kropka.eu> wrote in message
news:en3fhp$bv2$1@atlantis.news.tpi.pl...
> please, how to specify database name in schema operation like:
> select * from sys.schemas where name = <my-schema> ...
> create/drop schema ...
> ...
> ?
Have you tried using the scripting options for Management Studio's Object
Explorer to create a script to do this?
For the dropping a schema, right click the schema, choose Script schema
as... and then Drop or Create to a window or clipboard. The drop option will
create a script like:
USE [MyDb]
GO
/****** Object: Schema [MySchema] Script Date: 12/29/2006 18:07:59 ******/
IF EXISTS (SELECT * FROM sys.schemas WHERE name = N'MySchema')
DROP SCHEMA [MySchema]
The create option will give you something like:
USE [MyDB]
GO
/****** Object: Schema [MySchema] Script Date: 12/29/2006 18:09:47 ******/
CREATE SCHEMA [MySchema] AUTHORIZATION [MySchema]
You can remove the unnecessary USE statements and comments.
John
[Back to original message]
|