SQL Database Validation
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010
07:04 AM
08-17-2010
07:04 AM
SQL Database Validation
The sofware that I'm testing creates a new SQL database with a unique name everytime the software is run. I would like to create a script that validates the tables within each new database. Is it possible to validate a database with a dynmic name?
Thanks,
Melissa
Thanks,
Melissa
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2010
09:07 AM
08-17-2010
09:07 AM
The following code will list all existing databases on the server
//[JScript]
function Test1()
{
var cmd = ADO.CreateADOCommand();
cmd.ConnectionString = "Provider=SQLOLEDB.1;Data Source=MY-PC\\SQLEXPRESS;user id=MY_LOGIN;pwd=MY_PASSWORD;Integrated Security=SSPI;";
cmd.CommandText = "EXEC sp_databases";
cmd.CommandType = cmdText;
var rs = cmd.Execute();
rs.MoveFirst();
while(!rs.EOF)
{
Log.Message(rs.Fields("DATABASE_NAME").Value);
rs.MoveNext();
}
}
All you need to do is to get a list of all databases before your application create a new one, then once again after it and compare results 🙂
The difference will be a new created database.
And you need to use a correct command line to your server, of course
Gennadiy Alpaev
Software Testing Automation Tips - my new book
TestComplete Cookbook is published!
About Community Experts
//[JScript]
function Test1()
{
var cmd = ADO.CreateADOCommand();
cmd.ConnectionString = "Provider=SQLOLEDB.1;Data Source=MY-PC\\SQLEXPRESS;user id=MY_LOGIN;pwd=MY_PASSWORD;Integrated Security=SSPI;";
cmd.CommandText = "EXEC sp_databases";
cmd.CommandType = cmdText;
var rs = cmd.Execute();
rs.MoveFirst();
while(!rs.EOF)
{
Log.Message(rs.Fields("DATABASE_NAME").Value);
rs.MoveNext();
}
}
All you need to do is to get a list of all databases before your application create a new one, then once again after it and compare results 🙂
The difference will be a new created database.
And you need to use a correct command line to your server, of course
Gennadiy Alpaev
Software Testing Automation Tips - my new book
TestComplete Cookbook is published!
About Community Experts
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010
01:22 AM
08-18-2010
01:22 AM
Hi all,
We are also planning to publish a similar script in the How To section of our Support Portal.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2010
01:16 AM
08-25-2010
01:16 AM
Hi,
We've published a similar script here:
http://www.automatedqa.com/support/viewarticle.aspx?aid=17636
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
