Showing posts with label certain. Show all posts
Showing posts with label certain. Show all posts

Tuesday, March 20, 2012

Changing table owner SQL database

i'm looking for a script to change the ownership of some tables in SQL
database from a certain user to dbo
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!Hi.
You can utilize something as this:
sp_changeobjectowner [ @.objname = ] 'object' , [ @.newowner = ] 'owner'
This it is a stored procedure of SQL Server and only is able used by the use
rs in the roles SysAdmin and db_owner.
Hermilson Tinoco.
****************************************
*************
i'm looking for a script to change the ownership of some tables in SQL
database from a certain user to dbo|||Thanks for your reply.
Via other sources I've got a mail with the following script which
creates a stored procedure that you can execute to change the ownership
of several tables in one run:
CREATE PROC dbo.up_FixObjOwners
AS
SET NOCOUNT ON
DECLARE @.dynsql varchar(1000)
SET @.dynsql = ''
DECLARE @.Obj_Owner sysname
SET @.Obj_Owner = ''
DECLARE @.Obj_Type VARCHAR(30)
SET @.Obj_Type = ''
DECLARE @.Obj_Name sysname
SET @.Obj_Name = ''
DECLARE @.ObjCounter INT
SET @.ObjCounter = 0
DECLARE @.DBO CHAR(3)
SET @.DBO = 'DBO'
-- temp table to hold all objects not owned
-- by DBO
create table #ChangeOwners(
id int identity(1,1),
Obj_Owner sysname,
Obj_Name sysname,
Obj_Type varchar(30))
-- populate it
INSERT #ChangeOwners (Obj_Owner, Obj_Name, Obj_Type)
select
su.name,
so.name,
case
when type = 'u' then 'table'
when type = 'p' then 'sproc'
when type = 'v' then 'view'
end as obj_type
from sysusers su
join sysobjects so
on su.uid = so.uid
where su.name not in ('information_schema', 'dbo')
and so.type in ('p', 'u', 'v')
-- select * from #ChangeOwners
SET @.ObjCounter = @.@.rowcount -- holds the count of rows inserted into
#ChangeOwners
WHILE @.Objcounter > 0
BEGIN
-- construct string for object ownership change
SELECT @.Obj_Name = Obj_Owner + '.' + Obj_Name FROM #ChangeOwners WHERE
id = @.ObjCounter
SELECT @.Obj_Type = Obj_Type FROM #ChangeOwners WHERE id = @.ObjCounter
SET @.dynsql = 'sp_ChangeObjectOwner ''' + @.Obj_Name + ''', ' + @.DBO
--select @.dynsql
print 'changing ownership on ' + @.Obj_Type + ': ' + @.Obj_Name
EXEC(@.dynsql)
SET @.ObjCounter = @.ObjCounter - 1
END
-- ok all done, collect garbage
drop table #ChangeOwners
I hope u can use some other time too.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Note that changing the object owner (or renaming the proc) will not change
the underlying source text of the procedure. This can cause problems with
subsequent DDL scripting if the original owner was explicitly specified on
the CREATE statement.
Hope this helps.
Dan Guzman
SQL Server MVP
"stevesilent" <stevesilent@.devdex.com> wrote in message
news:OV1wf8J8DHA.2412@.TK2MSFTNGP09.phx.gbl...
> Thanks for your reply.
> Via other sources I've got a mail with the following script which
> creates a stored procedure that you can execute to change the ownership
> of several tables in one run:
> CREATE PROC dbo.up_FixObjOwners
> AS
> SET NOCOUNT ON
> DECLARE @.dynsql varchar(1000)
> SET @.dynsql = ''
> DECLARE @.Obj_Owner sysname
> SET @.Obj_Owner = ''
> DECLARE @.Obj_Type VARCHAR(30)
> SET @.Obj_Type = ''
> DECLARE @.Obj_Name sysname
> SET @.Obj_Name = ''
> DECLARE @.ObjCounter INT
> SET @.ObjCounter = 0
> DECLARE @.DBO CHAR(3)
> SET @.DBO = 'DBO'
> -- temp table to hold all objects not owned
> -- by DBO
> create table #ChangeOwners(
> id int identity(1,1),
> Obj_Owner sysname,
> Obj_Name sysname,
> Obj_Type varchar(30))
> -- populate it
> INSERT #ChangeOwners (Obj_Owner, Obj_Name, Obj_Type)
> select
> su.name,
> so.name,
> case
> when type = 'u' then 'table'
> when type = 'p' then 'sproc'
> when type = 'v' then 'view'
> end as obj_type
> from sysusers su
> join sysobjects so
> on su.uid = so.uid
> where su.name not in ('information_schema', 'dbo')
> and so.type in ('p', 'u', 'v')
> -- select * from #ChangeOwners
> SET @.ObjCounter = @.@.rowcount -- holds the count of rows inserted into
> #ChangeOwners
> WHILE @.Objcounter > 0
> BEGIN
> -- construct string for object ownership change
> SELECT @.Obj_Name = Obj_Owner + '.' + Obj_Name FROM #ChangeOwners WHERE
> id = @.ObjCounter
> SELECT @.Obj_Type = Obj_Type FROM #ChangeOwners WHERE id = @.ObjCounter
> SET @.dynsql = 'sp_ChangeObjectOwner ''' + @.Obj_Name + ''', ' + @.DBO
> --select @.dynsql
> print 'changing ownership on ' + @.Obj_Type + ': ' + @.Obj_Name
> EXEC(@.dynsql)
> SET @.ObjCounter = @.ObjCounter - 1
> END
> -- ok all done, collect garbage
> drop table #ChangeOwners
>
> I hope u can use some other time too.
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

changing subtotal expression

Hello,

I'm using a matrix report to display scores for certain items on certain criteria.
The items are on the left and the criteria at the top.

Now I would like to have some sort of subtotal row at the end of each group of items that displays the average value of all the scores for that group and not simply adds up the scores.
The built-in subtotal just adds up the scores, where I want the average value to be displayed.

Isn't there an easy way to change the subtotal expression and make it calculate the average value instead of the sum?

Thank you for your time,

Kenny

Yes this can be done through the InScope function. Please read this related thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=276213&SiteID=1

-- Robert

Changing SSIS property defaults

To make certain SSIS features work there are many properties that need to be set over and over for most containers in the package. For example with Checkpoint\Restart, you need to set (in most cases) all of the tasks' FailPackageOnFailure to True. If you miss one, the package may not restart properly and you might never know. There are other situations where as a development team we want certain properties to be usually set the same but differently from the SSIS default.

Is there a way to control the defaults that the SSIS IDE uses?

I remember back in classic VB that if you wanted to change the defaults of a bare form you could create a template form adjusted the way you like and put it in a templates folder. Then new forms added to a project would be based on the template form.

No worries. The same thing exists for SSIS:

SSIS: Location for your package templates
(http://blogs.conchango.com/jamiethomson/archive/2005/11/12/2380.aspx)

It won't allow you to set default properties of tasks though - which I think is what you are after.

-Jamie

|||

Yes, I was hoping to set defaults for packages and tasks. Any recommendations? Our DTS developers are balking at the multitude of properties needed to be set to implement certain features.

What do you name the templates that you put in the templates folder so that they are used in the IDE? Package1.dtsx?

Thanks.

|||

Chopaka wrote:

Yes, I was hoping to set defaults for packages and tasks. Any recommendations? Our DTS developers are balking at the multitude of properties needed to be set to implement certain features.

Sorry, that's not possible. It would be nice if it were though - perhaps you could suggest it at Microsoft Connect.

Whenever they build the ability to reuse pre-configured tasks then you will be able to do it. I wouldn't expect that until v3 at the earliest though.

Chopaka wrote:

What do you name the templates that you put in the templates folder so that they are used in the IDE? Package1.dtsx?

Whatever you like!

-Jamie

Sunday, March 11, 2012

changing set option to on from default server level setting

What are some things to watch out for if we change the default settings from
off to on for certain set options.
For eg: if i turn the set aritabort on at a server level, what are the cons
?
> For eg: if i turn the set aritabort on at a server level, what are the cons
That applications that relies on the old default behavior doesn't work correctly anymore. Always set
the setting in your app, and leave the defaults as is.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jamie" <jamesw@.hotmail.com> wrote in message news:etw6jze1FHA.164@.TK2MSFTNGP10.phx.gbl...
> What are some things to watch out for if we change the default settings from off to on for certain
> set options.
> For eg: if i turn the set aritabort on at a server level, what are the cons ?
>

changing set option to on from default server level setting

What are some things to watch out for if we change the default settings from
off to on for certain set options.
For eg: if i turn the set aritabort on at a server level, what are the cons
?> For eg: if i turn the set aritabort on at a server level, what are the cons
That applications that relies on the old default behavior doesn't work correctly anymore. Always set
the setting in your app, and leave the defaults as is.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jamie" <jamesw@.hotmail.com> wrote in message news:etw6jze1FHA.164@.TK2MSFTNGP10.phx.gbl...
> What are some things to watch out for if we change the default settings from off to on for certain
> set options.
> For eg: if i turn the set aritabort on at a server level, what are the cons ?
>

changing set option to on from default server level setting

What are some things to watch out for if we change the default settings from
off to on for certain set options.
For eg: if i turn the set aritabort on at a server level, what are the cons
?> For eg: if i turn the set aritabort on at a server level, what are the con
s
That applications that relies on the old default behavior doesn't work corre
ctly anymore. Always set
the setting in your app, and leave the defaults as is.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jamie" <jamesw@.hotmail.com> wrote in message news:etw6jze1FHA.164@.TK2MSFTNGP10.phx.gbl...[v
bcol=seagreen]
> What are some things to watch out for if we change the default settings fr
om off to on for certain
> set options.
> For eg: if i turn the set aritabort on at a server level, what are the con
s ?
>[/vbcol]

Friday, February 10, 2012

Changing Data Sources

If I have a dataset that uses a certain data source, if I
change the data source do I have to redefine my dataset
and replace the fields from the dataset in my designer...?
DanNope . I never had to do that
"alien251" wrote:
> If I have a dataset that uses a certain data source, if I
> change the data source do I have to redefine my dataset
> and replace the fields from the dataset in my designer...?
> Dan
>