Statement not executed or executed statement has no resultset

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

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

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

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.

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

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

Any other suggestions?

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?

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