Anu

Anu

  • 1.5k
  • 198
  • 8.9k

not able to create csv file

Feb 13 2023 5:22 PM

Hi

I need to run the powershell command from mvc application. | want to read the data from the database table (having more than 2crore data) and create csv file and download the file to users download folder. Can someone please check and help me to resolve the issue?

$DBName = "testdb"
$FilePath = "C:\\test\\File1.csv"
$SQLQuery= @"
select * from testsummary
"@
Invoke-Sqlcmd_ -Serverlnstance dbinst -Database $DBName -Query $SQLQuery | Export-
CSV $FilePath -NoTypelnformation

Thanks,

Anu


Answers (2)