Skip to content

HasTable

Darren Comeau edited this page Oct 14, 2018 · 1 revision

HasTable(String, String)

Return true if the table exists within the database.

Overloads

public bool HasTable(string schemaName, string tableName);

HasTable(string schemaName, string tableName)

Parameters

schemaName String

The database schema which hosts the object.

tableName String

The name of the database table which we should check the existence of.

Examples

// Setup the Database Tester object using the MS SQL implementation
var connectionstring = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=tempdb;Integrated Security=SSPI;";
VulcanAnalytics.DBTester.DatabaseTester tester = new VulcanAnalytics.DBTester.MsSqlDatabaseTester(connectionstring);

// Parameters for HasTable method
var schemaName = "dbo";
var tableName = "TestPerson";

// Call the HasTable method to check presence of table
var hasTable = tester.HasTable(schemaName, tableName);

Assert.IsTrue(hastable);