# Statement not executed or executed statement has no resultset

**URL:** <https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610>\
**Category:** Ansible Project\
**Created:** [December 2, 2023, 1:43am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610 "2023-12-02T01:43:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 2, 2023, 1:43am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/1 "2023-12-02T01:43:32Z")

</div>

I am getting below error when trying to execute an Insert mssql query, the row is getting inserted but somehow failing with this  
Statement not executed or executed statement has no resultset

this is my playbook

- name: Insert into sql server  
community.general.mssql\_script:  
login\_user: ‘username’  
login\_password: “{{ mssql\_login\_password }}”  
login\_host: “{{ mssql\_server }}”  
login\_port: “{{ mssql\_port }}”  
db: testdb  
script: “insert into [Test].[RP].[ApplicationCategory] values (NULL,NULL,‘xyz’,‘repo’,NULL,getdate(),1,NULL,‘xyz’,NULL,‘xyz’)”  
tags: jenkinsjob

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 2, 2023, 1:44am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/2 "2023-12-02T01:44:44Z")

</div>

correcting the yml formatting

- name: Insert into sql server  
community.general.mssql\_script:  
login\_user: ‘username’  
login\_password: “{{ mssql\_login\_password }}”  
login\_host: “{{ mssql\_server }}”  
login\_port: “{{ mssql\_port }}”  
db: testdb  
script: “insert into [Test].[RP].[ApplicationCategory] values (NULL,NULL,‘xyz’,‘repo’,NULL,getdate(),1,NULL,‘xyz’,NULL,‘xyz’)”  
tags: jenkinsjob

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [December 2, 2023, 6:53am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/3 "2023-12-02T06:53:46Z")

</div>

That sounds like something specific to your script, which entirely depends on your environment

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 2, 2023, 7:05am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/4 "2023-12-02T07:05:26Z")

</div>

I don’t think so, I see some others also had this issue on stack overflow, but that solution is giving me another error character max size.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [December 2, 2023, 7:49am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/5 "2023-12-02T07:49:48Z")

</div>

What does the server side logs look like? I would increase log verbosity there

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 4, 2023, 4:15pm UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/6 "2023-12-04T16:15:31Z")

</div>

I am able to run the same playbook on jenkins server directtly, not using jenkins job  
my pymssl : 2.2.7

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 4, 2023, 10:42pm UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/7 "2023-12-04T22:42:15Z")

</div>

Any other suggestions?

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [December 5, 2023, 5:55am UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/8 "2023-12-05T05:55:24Z")

</div>

Then problem is with ‘using jenkins job’, ie how ansible is invoked, not with ansible itself.

Also, what did the logs on the server side tell you?

---

<div class="post-metadata">

**Author:** ![Narmada\_Karthika](https://avatars.discourse-cdn.com/v4/letter/n/b5e925/32.png) [@Narmada\_Karthika](https://forum.ansible.com/u/Narmada_Karthika)\
**Post date:** [December 8, 2023, 10:20pm UTC](https://forum.ansible.com/t/statement-not-executed-or-executed-statement-has-no-resultset/38610/9 "2023-12-08T22:20:20Z")

</div>

I think I fixed the issue I added ;Select 1 this at the end of the insert statement and that fixed the issue when running mssql module to run an Insert query through jenkins console
