Category Archives: SQL Server 2005 SMO

SMO and Adhoc Queries

Start SQL Profiler, chose SQL:BatchCompleted event only and set filter on TextData to ‘%product%’. In SSMS, go to AdventureWorks database, right click Production.Product table–>Script Table as –>Create to–>Clipboard. Go back SQL profiler, you will find 23 adhoc calls sent to … Continue reading

Posted in SQL Server 2005 SMO | Leave a comment

Smo issue when generating drop default constraint script

In SQL Server 2005, using the following code to script out dropping default constraints, it always fails with the following exception:  Exception: {"Script failed for DefaultConstraint ‘DF_Employee_VacationHours’. "} InnerException: {"Object reference not set to an instance of an object."} using … Continue reading

Posted in SQL Server 2005 SMO | 1 Comment