private bool TableExists(AdHocSqlRunner sqlRunner, Dictionary <string, object> parameters) { var result = sqlRunner.ExecuteScalar($"select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = @table and TABLE_SCHEMA = @schema", parameters) as int?; return(result == 1); }
/// <summary> /// Verifies the existence of targeted schema. If schema is not verified, will check for the existence of the dbo schema. /// </summary> private bool SchemaExists(AdHocSqlRunner sqlRunner, Dictionary <string, object> parameters) { var result = sqlRunner.ExecuteScalar($@"SELECT 1 FROM sys.schemas WHERE name = @schema", parameters) as int?; return(result == 1); }