Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Formatting output from SQL query

$
0
0
Hi,

What I am trying to do is query a View in a SQL database and export the result to a CSV file.

Connecting to the SQL database and running the query works and I can store the result in a DataTable in PowerShell.
But the issue is with how some of tha data returned is formated in PowerShell.

When I run my query using SQL Server Management Studio (SSMS) I get the formatting I am looking for.

Here are two examples

1)
In SSMS: 2016-01-01
In the DataTable: 2016-01-01 00:00:00

2)
In SSMS: 123.50
In the DataTable: 123,50 (comma instead of dot)

Is there any way for me to just save it as it is stored in the databse table?



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>