mysql - SQL "Not Like '%%'" Conditional Insert/Update -
i have conditional sql statement executed via powershell inserts or updates database based on existence of rows. i'm using script inventory software. however, numerous security updates , hotfixes appear when script runs, , i'd exclude these records being placed in sql database don't qualify applications. i've tried using not clause few different ways , can't working. i've tried using except well. advice appreciated! code below last syntax attempt:
invoke-sqlcmd -serverinstance "$sqlserver" -database "$sqldb" -query "update $softwaretable set name = n'$($csvappname -replace "'", "''")', version = n'$($csvversion -replace "'", "''")', product_id = n'$($csvappid -replace "'", "''")', arch = n'$($csvarch -replace "'", "''")' product_id = '$csvappidgo' name not '%hotfix%' , '%security update%'; if @@rowcount=0 insert $softwaretable (name, version, product_id, arch) values (n'$($csvappname -replace "'", "''")', n'$($csvversion -replace "'", "''")', n'$($csvappid -replace "'", "''")', n'$($csvarch -replace "'", "''")') name not '%hotfix%' , '%security update%'" }
invoke-sqlcmd -serverinstance "$sqlserver" -database "$sqldb" -query "update $softwaretable set name = n'$($csvappname -replace "'", "''")', version = n'$($csvversion -replace "'", "''")', product_id = n'$($csvappid -replace "'", "''")', arch = n'$($csvarch -replace "'", "''")' product_id = '$csvappidgo' , name not '%hotfix%' , name not '%security update%'; if @@rowcount=0 insert $softwaretable (name, version, product_id, arch) values (n'$($csvappname -replace "'", "''")', n'$($csvversion -replace "'", "''")', n'$($csvappid -replace "'", "''")', n'$($csvarch -replace "'", "''")') name not '%hotfix%' , name not '%security update%'" }
Comments
Post a Comment