How to Use Powershell to Exec an "ALTER PROC" Script on Every DB

Hi, I'm a PS newbie. How do i use it to update an SP on every DB? I've
got 100 DBs on my instance and I need to make a small tweak to an SP
on all the DBs.

Thanks
0
nzrdb6
4/13/2010 11:17:56 AM
sqlserver.server 1327 articles. 0 followers. Follow

1 Replies
569 Views

Similar Articles

[PageSpeed] 44

On 4/13/2010 7:17 AM, nzrdb6 wrote:
> Hi, I'm a PS newbie. How do i use it to update an SP on every DB? I've
> got 100 DBs on my instance and I need to make a small tweak to an SP
> on all the DBs.
>
> Thanks
Install SQLPSX (http://sqlpsx.codeplex.com/).

Then from a PS cmd use something like:

PS > $instance = Get-sqlserver "server\instance"
PS > $instance.databases | % { set-sqldata -sqlserver $instance.name -dbname $_.name -qry "CREATE PROC asdf AS BEGIN 
SELECT 1 END;" }
0
Dan
4/13/2010 12:52:06 PM
Reply:

Similar Artilces:

How to Use Powershell to Exec an "ALTER PROC" Script on Every DB
Hi, I'm a PS newbie. How do i use it to update an SP on every DB? I've got 100 DBs on my instance and I need to make a small tweak to an SP on all the DBs. Thanks On 4/13/2010 7:17 AM, nzrdb6 wrote: > Hi, I'm a PS newbie. How do i use it to update an SP on every DB? I've > got 100 DBs on my instance and I need to make a small tweak to an SP > on all the DBs. > > Thanks Install SQLPSX (http://sqlpsx.codeplex.com/). Then from a PS cmd use something like: PS > $instance = Get-sqlserver "server\instance" PS > $instance.databases | ...

Grant alter procedure permissions
I have a request to create a database role with permissions to create and update stored procedures and functions but not change the table definition, keys, indexes, and triggers. I created the role in the development database and gave it the following permissions: Create Procedure Create Function Alter Any Schema View Definition With this role the developers can create and modify stored procedures and functions. However, they can still perform certain edits on tables (eg. they can drop foreign keys but cannot create them. Reading on BOL, I see the objects in the schema ...