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

connect sql, get data, add column, export csv

$
0
0

Hi,

I need to connect to SQL Server 2005 via remote powershell with SQL Authentication, run a query and export it to csv with different column headers. Bu I also want add one or two more columns with static information.

For example the CSV should look like this:

Column1,Column2,Column3,Column4

test@test.com,Password,mail.test.com,username1

johndoe@test.com,Password2,mail.test.com,username2

Column1, 2 and 4 is in sql and can be retrieved with sql query but Column3 must be added before exporting this query to csv.

How can I do this?


Those who are skilled in combat do not become angered, those who are skilled at winning do not become afraid. Thus the wise win before the fight, while the ignorant fight to win.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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