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
AnuPosted Feb 14, 2023, 7:19 AM
Thanks,
Anu
Amit MohantyPosted Feb 14, 2023, 5:37 AM
Try this
Save the avobe script to a ps1 type file and run the file using powershell.