Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to find out the Objects Defacults Schema Details Expand / Collapse
Author
Message
Posted Tuesday, April 1, 2008 4:50 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, September 12, 2009 9:12 PM
Points: 65, Visits: 224
HI All,

I would like to change the default schema details of all the logins created
Could yoy please specify how do i find out the schema details
and also i would like to change all the objects default schema to DBO

Regards'
Smm
Post #477499
Posted Tuesday, April 1, 2008 5:12 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:29 AM
Points: 870, Visits: 915
shine.mm (4/1/2008)
HI All,

I would like to change the default schema details of all the logins created
Could yoy please specify how do i find out the schema details
and also i would like to change all the objects default schema to DBO

Regards'
Smm


What schema details do you want to know exactly?

To change the default schema:

ALTER USER Mary51 WITH DEFAULT_SCHEMA = dbo

To change objects to the default schema use:

ALTER SCHEMA dbo TRANSFER fully_qualified_object_name

Hope that helps.


Karl
source control for SQL Server
Post #477511
Posted Wednesday, April 2, 2008 11:50 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, September 12, 2009 9:12 PM
Points: 65, Visits: 224
Hi,
What i would need is i would like to know each databases,Which are the Objects(Tables,Stored Procedures Etc.)not belong to the schema DBO.
Fist i need to know which are the objects not belong to DBO

Then i would like to change the schema of this objects to DBO

Please help me
Smm
Post #478969
Posted Thursday, April 3, 2008 12:48 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 6:29 AM
Points: 870, Visits: 915
shine.mm (4/2/2008)
Hi,
What i would need is i would like to know each databases,Which are the Objects(Tables,Stored Procedures Etc.)not belong to the schema DBO.
Fist i need to know which are the objects not belong to DBO

Then i would like to change the schema of this objects to DBO

Please help me
Smm


This query will give you objects in a single database that do not belong to dbo. I've also constructed the command you'd need to run to transfer the object to a different schema.

select schema_name(schema_id), name, command = 'ALTER SCHEMA dbo TRANSFER [' + schema_name(schema_id) + '].[' + name + ']'
from sys.objects
where schema_name(schema_id) <> 'dbo'
and type in('U','P','V', 'FN','TF','IF')



Karl
source control for SQL Server
Post #478993
Posted Friday, April 11, 2008 2:11 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, September 12, 2009 9:12 PM
Points: 65, Visits: 224
hi,

Is there any method to find out
Database users which do not have DBO as their default schema.

Any query

Smm
Post #483485
Posted Friday, April 11, 2008 2:36 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, February 27, 2014 3:44 AM
Points: 179, Visits: 331
You can use the following script for a specific database -

SELECT *
FROM sys.database_principals
WHERE [type] IN ('U','S')
AND ISNULL(default_schema_name,'')<>'dbo'




Chandrachurh Ghosh
DBA – MS SQL Server
Ericsson India Global Services Limited
Quality is not an act, it is a habit.
Post #483497
Posted Friday, April 11, 2008 6:17 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, September 12, 2009 9:12 PM
Points: 65, Visits: 224
Thanks alot,Also I would need couple of details ,could you help me
---
This is what I needed,
1)Objects which do not belong to DBO

This is the query we are using to find out

select schema_name(schema_id)as ObjectName, name,type,type_desc from sys.objects
where schema_name(schema_id) <> 'dbo'
and type in('U','P','V', 'FN','TF','IF','PK','UQ')
go

2)Database users which do not have DBO as their default schema

SELECT *
FROM sys.database_principals
WHERE [type] IN ('U','S')
AND ISNULL(default_schema_name,'')<>'dbo'

We would like to create a report out of it and let a procedure run in every instance on a daily basis. The procedures should write the information into seperate tables in theOne of DB(Like ABC)database
I need to have the Sp in one Database and it needs to check all the Database and fetch the details into separate tables as per the database name

Could you please help me
Post #483589
Posted Friday, April 11, 2008 6:19 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Saturday, September 12, 2009 9:12 PM
Points: 65, Visits: 224
HI chandru,

I posted one topic ,could you please help me

Post #483592
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse