I am trying to pass a variable into a SQL update statement to update a table column. I run the following commands and do not receive any errors. However, the table column was not updated.
$SQLserver = 'servername'
$Database = 'databasename'
$variable = (Get-Content -path \\share\test\testfile.json | ConvertFrom-Json)
$vm = Invoke-SQLCMD -ServerInstance $SQLServer -Database $Database -Query "Update (tablename) set (columnname) = 1 where vmid IN ('$variable.attribute')"
I see that all the data is being passed into the variable. But, the update statement is not updating my column. Also, I do not receive any error messages when running my code.