SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to find out the Objects Defacults Schema Details


How to find out the Objects Defacults Schema Details

Author
Message
sps-554505
sps-554505
SSC-Enthusiastic
SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)

Group: General Forum Members
Points: 133 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
SQLZ
SQLZ
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1288 Visits: 940
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
sps-554505
sps-554505
SSC-Enthusiastic
SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)

Group: General Forum Members
Points: 133 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
SQLZ
SQLZ
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1288 Visits: 940
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
sps-554505
sps-554505
SSC-Enthusiastic
SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)

Group: General Forum Members
Points: 133 Visits: 224
hi,

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

Any query

Smm
Chandrachurh Ghosh
Chandrachurh Ghosh
Old Hand
Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)Old Hand (365 reputation)

Group: General Forum Members
Points: 365 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.
sps-554505
sps-554505
SSC-Enthusiastic
SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)

Group: General Forum Members
Points: 133 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
sps-554505
sps-554505
SSC-Enthusiastic
SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)SSC-Enthusiastic (133 reputation)

Group: General Forum Members
Points: 133 Visits: 224
HI chandru,

I posted one topic ,could you please help me
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search