function Test-SQLTableExists | |
{ | |
param ($Instance,$Database,$TableName) | |
$Return = $SQL = $dataTable = $null | |
$sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'$TableName'" | |
$dataTable = Invoke-Sqlcmd2 -ServerInstance $Instance -Database $Database -Query $sql | |
if ($dataTable) {$return = $true} | |
else {$return = $false} | |
$Return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment