PowerShell to SQL- Array function always return element 0 first


Any Array value if you have like


Always, Always put "| Out-Null" behind to prevent the null element feed Function first and get "False" then return "0" back.
So your Table doesn't need to add one more "Ghost" column

Reference websites:

Returning values from Fuctions in PowerShell... Tricky

Array size differs between return value

Issues to be aware of when transitioning from VBScript to PowerShell

Returning an exit code from a PowerShell script



Newer Older