0

I want to generate a XML with SQL Server.

I wrote this :

Select CUV_CAPA 
from dbo.EQT 
FOR XML PATH('Table1'), Root('SomeRoot'), TYPE  

And the result is :

<SomeRoot>
  <Table1>
    <CUV_CAPA>600.00000000</CUV_CAPA>
  </Table1>
  <Table1>
    <CUV_CAPA>50.00000000</CUV_CAPA>
  </Table1>
</SomeRoot>

After I want use this data in a C# application, and it's not working because my regional settings is , instead .

What can I do to have the correct decimal separator when I generate XML?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Frederic7391
  • 95
  • 3
  • 12
  • Did you try replacing the "." with "," as the simplest solution? – Hozikimaru Oct 06 '15 at 21:29
  • It could be a solution, but this application must works in all country. How I can know when replacing and when not? And XML output is always dot delimiter regardless of regionals? – Frederic7391 Oct 06 '15 at 21:33
  • You should know what `CultureInfo` is being used by the inputs and apply it to all the related calculations (e.g., define it as the culture of your current thread). The numbers (or the dates or any other culture-related issue) of the inputs have to be properly defined. Otherwise, your application would think that the days are months and the thousands separators are decimal separators. – varocarbas Oct 06 '15 at 21:36
  • SQL Server always return `.` for XML Output ? – Frederic7391 Oct 07 '15 at 08:01
  • I think the solution of my problem is to use invariant culture, like in this post http://stackoverflow.com/questions/2423377/what-is-the-invariant-culture – Frederic7391 Oct 07 '15 at 08:54

0 Answers0