# charset parameter mssql\_db module

**URL:** <https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [April 29, 2020, 3:53pm UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813 "2020-04-29T15:53:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@Rafael\_Oliveira](https://forum.ansible.com/u/Rafael_Oliveira)\
**Post date:** [April 29, 2020, 3:53pm UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/1 "2020-04-29T15:53:35Z")

</div>

Hello everyone,

If possible, how can I set the charset parameter to mssql\_db module?

In python I can do something like that:

conn = pymssql.connect(server, user, password, db\_name, charset=‘WINDOWS-1252’)

KR,  
Rafael

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 29, 2020, 7:04pm UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/2 "2020-04-29T19:04:24Z")

</div>

I guess you could but the create table statement in a file and point target to  
it with state: import.

---

<div class="post-metadata">

**Author:** ![Rafael\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@Rafael\_Oliveira](https://forum.ansible.com/u/Rafael_Oliveira)\
**Post date:** [April 29, 2020, 7:31pm UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/3 "2020-04-29T19:31:21Z")

</div>

I’m sorry I don’t know if I got your point, nevertheless let me break down my situation:

I already have DB structure where those a lot of tables were created with German UMLAUT öäüÜÖÄ.

From time to time I have to run some scripts to maintain these tables, I’d like to automate this script execution so I created the following task:

- name: Run script  
mssql\_db:  
name: “{{ DB\_NAME }}”  
login\_host: “{{ DB\_HOST }}”  
login\_user: “{{ DB\_USER }}”  
login\_password: “{{ DB\_PASS }}”  
state: import  
target: “{{ SCRIPT\_PATH }}”

The step before that is SVN Checkout, as you can see I’m running a script in the import state, how should I change my script, that’s the point that I could not understand.

Thanks in advance for your support.

KR,  
Rafael

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 30, 2020, 9:24am UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/4 "2020-04-30T09:24:57Z")

</div>

Every MySQL command that support charset like alter/create database you can add  
charset=\<\> to it, check the MySQL documentation on how.

But if you do a "ansible-doc mysql\_db" you'll see that it has an encoding option.

&nbsp;&nbsp;&nbsp;&nbsp;- encoding  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encoding mode to use, examples include `utf8' or `latin1\_swedish\_ci'  
&nbsp;&nbsp;[Default: (null)]

After looking at the source code, this option has been there since before 2014  
but the online documentation doesn't show it and several other options.

---

<div class="post-metadata">

**Author:** ![Rafael\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@Rafael\_Oliveira](https://forum.ansible.com/u/Rafael_Oliveira)\
**Post date:** [April 30, 2020, 12:58pm UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/5 "2020-04-30T12:58:07Z")

</div>

But I’m using mSsql\_db

☹

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 2, 2020, 8:51am UTC](https://forum.ansible.com/t/charset-parameter-mssql-db-module/32813/6 "2020-05-02T08:51:53Z")

</div>

That makes a huge difference, sorry I misread.
