Link to home
Start Free TrialLog in
Avatar of itsonlyme4
itsonlyme4

asked on

correct sytax for sp_msforeachdb SQL Server 2005

I am trying to use the sp_msforeachdb stored procedure to execute the following commands and I cannot get the sysntax correct.  can anyone help?

When I issue this:
sp_msforeachdb 'EXEC dbo.sp_changedbowner @loginame = N'DOMAIN\DomainUser', @map = false'

Open in new window

I get this:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'DOMAIN'.

and when I issue this:
sp_msforeachdb 'EXEC sp_change_users_login 'Auto_fix', 'DOMAIN\DomainUser''

Open in new window

i get this:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Auto_fix'.
ASKER CERTIFIED SOLUTION
Avatar of LCSandman8301
LCSandman8301
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itsonlyme4
itsonlyme4

ASKER

Awesome!  Thank you!