I would like to apply the objects' permissions after to apply an snapshot.
To do it, I need a script file, with the grant commands to apply that
permissions.
Could I get that script just before applying the snapshot with any t-sql
command to generate and save the script file with these permissions?.
So if the objects' permissions have change from the last time I applied the
snapshot or i have created new objects, I can be sure that the permissions
transfered are accurate.
Thank you
Jorge,
here is a script I use which can be adapted for your needs. srvname is the
subscriber and delivery is the name of my database. I already have the
logins and users, and if you don't have them, then I'll leave you to create
that script

Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
SELECT 'Grant ' +
case
when action = 193 then 'SELECT'
when action = 195 then 'INSERT'
when action = 196 then 'DELETE'
when action = 197 then 'UPDATE'
when action = 224 then 'EXECUTE'
end as Grant1,
' ON [' + delivery.dbo.sysobjects.name + '] TO ' +
delivery.dbo.sysusers.name as Grant2
--,ss.srvname
--,delivery.dbo.syspublications.name AS Publication
FROM delivery.dbo.syssubscriptions
INNER JOIN delivery.dbo.sysextendedarticlesview ON
delivery.dbo.syssubscriptions.artid =
delivery.dbo.sysextendedarticlesview.artid
INNER JOIN delivery.dbo.sysobjects ON
delivery.dbo.sysextendedarticlesview.objid =
delivery.dbo.sysobjects.id
INNER JOIN delivery.dbo.syspublications ON
delivery.dbo.sysextendedarticlesview.pubid =
delivery.dbo.syspublications.pubid
INNER JOIN master..sysservers ss on ss.srvid =
delivery.dbo.syssubscriptions.srvid
left outer JOIN delivery.dbo.sysprotects on
delivery.dbo.sysprotects.id = delivery.dbo.sysobjects.id
left outer JOIN delivery.dbo.sysusers on
delivery.dbo.sysprotects.uid = delivery.dbo.sysusers.uid
where action in (193,195,196,197,224)
--and srvname = 'xxx\PDSCOPY'
and srvname = 'yyy\PDSCOPY'
order by ss.srvname, delivery.dbo.syspublications.name,
delivery.dbo.sysobjects.name, delivery.dbo.sysusers.name
"Jorge" <Jorge@.discussions.microsoft.com> wrote in message
news:18488D2B-1F12-4D30-91C7-894EDE31D557@.microsoft.com...
> Hi.
> I would like to apply the objects' permissions after to apply an snapshot.
> To do it, I need a script file, with the grant commands to apply that
> permissions.
> Could I get that script just before applying the snapshot with any t-sql
> command to generate and save the script file with these permissions?.
> So if the objects' permissions have change from the last time I applied
the
> snapshot or i have created new objects, I can be sure that the permissions
> transfered are accurate.
> Thank you
|||Very good, Paul.
It's exactly what I was looking for
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> escribi en el mensaje
news:eXmbfaX2EHA.2192@.TK2MSFTNGP14.phx.gbl...
> Jorge,
> here is a script I use which can be adapted for your needs. srvname is the
> subscriber and delivery is the name of my database. I already have the
> logins and users, and if you don't have them, then I'll leave you to
> create
> that script

> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
> SELECT 'Grant ' +
> case
> when action = 193 then 'SELECT'
> when action = 195 then 'INSERT'
> when action = 196 then 'DELETE'
> when action = 197 then 'UPDATE'
> when action = 224 then 'EXECUTE'
> end as Grant1,
> ' ON [' + delivery.dbo.sysobjects.name + '] TO ' +
> delivery.dbo.sysusers.name as Grant2
> --,ss.srvname
> --,delivery.dbo.syspublications.name AS Publication
> FROM delivery.dbo.syssubscriptions
> INNER JOIN delivery.dbo.sysextendedarticlesview ON
> delivery.dbo.syssubscriptions.artid =
> delivery.dbo.sysextendedarticlesview.artid
> INNER JOIN delivery.dbo.sysobjects ON
> delivery.dbo.sysextendedarticlesview.objid =
> delivery.dbo.sysobjects.id
> INNER JOIN delivery.dbo.syspublications ON
> delivery.dbo.sysextendedarticlesview.pubid =
> delivery.dbo.syspublications.pubid
> INNER JOIN master..sysservers ss on ss.srvid =
> delivery.dbo.syssubscriptions.srvid
> left outer JOIN delivery.dbo.sysprotects on
> delivery.dbo.sysprotects.id = delivery.dbo.sysobjects.id
> left outer JOIN delivery.dbo.sysusers on
> delivery.dbo.sysprotects.uid = delivery.dbo.sysusers.uid
> where action in (193,195,196,197,224)
> --and srvname = 'xxx\PDSCOPY'
> and srvname = 'yyy\PDSCOPY'
> order by ss.srvname, delivery.dbo.syspublications.name,
> delivery.dbo.sysobjects.name, delivery.dbo.sysusers.name
>
> "Jorge" <Jorge@.discussions.microsoft.com> wrote in message
> news:18488D2B-1F12-4D30-91C7-894EDE31D557@.microsoft.com...
> the
>
No comments:
Post a Comment