Hi @ramawat,
I made a test what @Pablo_Sanchez mentioned with a little table. It is working fine. can you attache the table script and your insert query as a zip file. May be it helps to do the analysis.
But any way, Here I have attached xaml and table for your reference.
SqlServer.zip (2.7 KB)
Regards
Balamurugan.S