Tag Info

New answers tagged

2

You could write a PowerShell script to achieve this and have that called from the SQL Agent which allows PowerShell as one of the command types: Here's some code to help you get started: Function Get-MyConnectionString{ param( [string]$Server, [string]$Database, [string]$UserName, [string]$Password, ...


4

I don't think there's a built-in way to do this, but here are a few alternatives: Use OPENDATASOURCE like this: EXEC OPENDATASOURCE('SQLNCLI', 'Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=master;Application Name="test app"') .master.sys.sp_configure; Note that using OPENDATASOURCE requires you to turn on the Ad hoc Distributed ...


0

Try to create the PC\user as a login and give him the backup privilege in your database with this code. USE [master] GO CREATE LOGIN [SERVER\Test1] FROM WINDOWS WITH DEFAULT_DATABASE=[master] GO USE [mydb] GO CREATE USER [SERVER\Test1] FOR LOGIN [SERVER\Test1] GO ALTER ROLE [db_backupoperator] ADD MEMBER [SERVER\Test1] GO


1

I encountered a bit of similar frustration w/ the documentation on Books Online saying 'when scheduling your job, add logic to only execute on the primary' but not saying how to do so. The sys.fn_hadr_backup_is_preferred_replica is super-nice for backup jobs, but there doesn't seem to be a similar function for 'is primary' or what have you. Fortunately you ...



Top 50 recent answers are included