Find Jobs
Hire Freelancers

SQL Server Job syntax

$10-30 USD

Complété
Publié il y a plus d’un an

$10-30 USD

Payé lors de la livraison
I am attempting to get the following code to work in a SQL Server 2019 Standard job for basic availability groups but it is failing with the below error and I don't know why. IF (SELECT primary_replica FROM sys.dm_hadr_availability_group_states) is NULL BEGIN PRINT 'This is a not an AG member server. –Not an AG Member Server and Job Execution should continue.' END ELSE IF (SELECT primary_replica FROM sys.dm_hadr_availability_group_states) = @@Servername BEGIN PRINT 'This is a AG Primary Replica. –Do Nothing. This is an AG Primary Replica and Job Execution should continue.' END ELSE IF (Select primary_replica FROM sys.dm_hadr_availability_group_states)= @@Servername BEGIN PRINT 'This is a AG Secondary Replica. –Stop Job. This is an AG Secondary Replica and we do not want Job Execution to continue on this Node.' DECLARE @job_id UNIQUEIDENTIFIER; SET @job_id = CONVERT(UNIQUEIDENTIFIER, CONVERT(VARBINARY(34), '$(ESCAPE_SQUOTE(JOBID))', 1)); EXECUTE msdb.dbo.sp_stop_job @job_id = @job_id; END Error: Msg 512, Level 16, State 1, Line 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Msg 512, Level 16, State 1, Line 5 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Msg 512, Level 16, State 1, Line 9 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Code in comments section on this website: [login to view URL] Comment #4
N° de projet : 35188171

Concernant le projet

9 propositions
Projet à distance
Actif à il y a 1 an

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux
Décerné à :
Avatar de l'utilisateur
$0 USD en 1 jour
5,0 (7 commentaires)
5,6
5,6
9 freelances proposent en moyenne $27 USD pour ce travail
Avatar de l'utilisateur
I will create, optimize and migrate your SQL,Oracle,MS Access, postgresql, mysql , maridb database.I will help you with database projects and solve any sql queries.I will do database design task and project with sql queries I am a Certified Database Administrator, DB Architect and extensively worked on MySQL, MS SQL Server, AWS RDS, PostgreSQL, Oracle and MariaDB. I Do: Normalization Logical Model and Physical Model ERD and Extended ERD ERD translation User management Table and Report Design Query and Simple and Complex Queries Create Joins and CRUD Functions Query Optimization Database Objects Creation (Index, View, Sequence, etc) Database Implementation. I am at your service, feel free to place your order now.
$50 USD en 7 jours
5,0 (10 commentaires)
5,9
5,9
Avatar de l'utilisateur
Hello Friend ! I can help you to fix the SQL Script and make it executable. We can do a 15-minutes free call to discuss the project requirements and our work plan. I have 11+ years of exceptional knowledge and experience in high performance OLTP systems (Microsoft SQL Server). Please feel free to ask for adjustment if my Bid Amount or Hourly Rate does not fit your budget. Warm regards, Kundan Bihari ( SQL Server Consultant )
$40 USD en 1 jour
5,0 (35 commentaires)
5,1
5,1
Avatar de l'utilisateur
I can help you with sql server scripts , please ping/connect me now I am available. Please check my reviews and project which I have completed. I can create sql queries for sql server database as per design, let me know when to proceed. I can work on future works for databases also if needed. I will work for cheapest budget within time, budget can be re negotiated again, send the details for the project. Please contact me asap. I have 12+ years of experience in database programming, website designing, powershell scripting and android development. Feel free to message me anytime if you need to discuss this further.
$10 USD en 1 jour
5,0 (11 commentaires)
4,4
4,4
Avatar de l'utilisateur
Hello there, I have read your requirements and am confident I am the right candidate for the job. Among other things, I have over ten years of experience in Oracle PLSQL, PostgreSQL, MySQL, MS SQL, and others. Furthermore, I am available 24x7 to answer any questions you may have about the requirements. I am looking forward to hearing from you as soon as possible. I would appreciate it if you would click the chat button for me if you are interested. Thanks a lot. Best regards. Courser Xu
$25 USD en 7 jours
5,0 (5 commentaires)
3,8
3,8
Avatar de l'utilisateur
Hi , I am having experience as a software developer with more than two years. I am hoping to help you as a technical person.
$20 USD en 3 jours
0,0 (0 commentaires)
0,0
0,0
Avatar de l'utilisateur
If you write SELECT top 1 primary_replica FROM sys.dm_hadr_availability_group_states I think is will correct. The problem is that you want to compare a value with more values.
$20 USD en 7 jours
0,0 (0 commentaires)
0,0
0,0

À propos du client

Drapeau de UNITED STATES
Conyers, United States
5,0
34
Méthode de paiement vérifiée
Membre depuis nov. 12, 2008

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.