Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Validating SQL Scripts following install

Author  Topic 

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-01-18 : 14:11:27
Guys,
Just curious how all you guys validate scripts following an install.

For example, coding a script to verify table modifications were made, or inserts completed correctly.

Best practices anyone??

Just knowing my installation scripts completed without errors is enough for me, but our installation team wants a validation script that they can run following the install that checks for the objects/data, and display a pretty message to them upon success, "All database objects have been validated."

Any ideas??

-- for data
IF (SELECT COUNT(*) FROM table WHERE column = 'Inserted Value') <> 1
BEGIN
PRINT 'Insert verified'
END
ELSE
BEGIN
PRINT 'Error validating insert'
END





Kristen
Test

22859 Posts

Posted - 2005-01-18 : 14:15:59
We have an INSERT statement in all our scripts that logs that the script ran (Name, Date/Time and VersionNumber). Each Sproc is in a separate file. We compare the latest entry in the log, for each "name", to a KnownGood log file.

You could also generate a script of the database and compare against a KnownGood script. However, SQL Server used to script each CREATE in a slightly random order, so comparing scripts from two servers was not that easy - dunno if it still does teh RandomOrderScripting in SQL2000.

Compare the sysobjects tables from Target and KnownGood databases perhaps?

Kristen
Go to Top of Page
   

- Advertisement -