1

Currently My code is

Invoke-sqlcmd -query "Select * from master.sys.table" -ServerInstance myserver -database -mydb | convert-csv | select -skip 2 | .\7z.exe a -si tgzip $gzipedfilename

The problem here is, Invoke-sqlcmd is producing huge resultset and which in turn putting huge pressure on convert-csv and it's throwing out of memory exception.

Is there a way Invoke-sqlcmd produces the csv resultset directly?

HimalayanNinja
  • 421
  • 3
  • 11
  • Or you could use Select Count(*) and iterate through a smaller collection. get-help Invoke-sqlcmd shows no direct output. – lloyd Apr 06 '17 at 05:13

0 Answers0