# How to execute a SQL Script ( MS SQL 2014 SP2 ) by Ansible

**URL:** <https://forum.ansible.com/t/how-to-execute-a-sql-script-ms-sql-2014-sp2-by-ansible/29072>\
**Category:** Ansible Project\
**Created:** [November 20, 2018, 4:36am UTC](https://forum.ansible.com/t/how-to-execute-a-sql-script-ms-sql-2014-sp2-by-ansible/29072 "2018-11-20T04:36:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [November 20, 2018, 4:36am UTC](https://forum.ansible.com/t/how-to-execute-a-sql-script-ms-sql-2014-sp2-by-ansible/29072/1 "2018-11-20T04:36:15Z")

</div>

Hello Guys,

I have copied a script on MS SQL server on c:\temp\always-on.sql

I’m wondering how to have it executed by Ansible, win\_shell module? or is there any specialized module for MSSQL for Ansible?

Kindly assist

Thanks  
Ameya Agashe

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 20, 2018, 6:06am UTC](https://forum.ansible.com/t/how-to-execute-a-sql-script-ms-sql-2014-sp2-by-ansible/29072/2 "2018-11-20T06:06:41Z")

</div>

There is no specific mssql query module part of ansible itself, but a 3rd party module does exist for this purpose:  
[https://github.com/melmorabity/ansible-mssql-query](https://github.com/melmorabity/ansible-mssql-query)  
If you can, report on its usability.

Dick

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [November 20, 2018, 11:58am UTC](https://forum.ansible.com/t/how-to-execute-a-sql-script-ms-sql-2014-sp2-by-ansible/29072/3 "2018-11-20T11:58:14Z")

</div>

Sounds good, I shall certainly try and provide feedback here.

Many thanks

Ameya Agashe
