Skip to content

Tag: powershell

sql distinct statement not working in powershel script

I am trying to run the following sql command on a powershell script: I set the following as a variable: after some other commands, i have the following: The above command works perfectly in SQL, but when I run on my powershell I get the error: Please can anyone advise? Thank you. Answer Thank you to Luuk and …

SQL extract data to Excel using Powershell

I want to extract data from SQL server to a new excel file using powershell . For small data set my code works but some tables has more than 100.000 rows and this will take ages. The reason why I don’t use the utility in SQl server is because I want to extract mutilple tables. Is there a way to