Using MERGE with Invoke-SqlCmd

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Joshua Taylor Joshua Taylor 2 years, 2 months ago.

  • Author
    Posts
  • #18764
    Profile photo of Joshua Taylor
    Joshua Taylor
    Participant

    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. 🙂

You must be logged in to reply to this topic.