Using MERGE with Invoke-SqlCmd

Has anyone used MERGE with Invoke-SqlCmd using a PowerShell object as source?

I’m using Out-DataTable from the Technet repository to format a PS object as a table that can be written to SQL. My script currently uses UPDATE to update the table daily when run, but I’d like to try to use MERGE instead as it would shorten my code considerably. I’ve been told that MERGE must use an existing SQL table as source and that an object won’t work, but I can’t confirm this.

I know there probably aren’t many SQL guys on here, but figured it couldn’t hurt to ask. :slight_smile: