How to forcely drop tables in SQL Server 2008

This script can drop a SQL Server table. It automaticly remove all the constraints of the table before the drop query.


先删除所有constraints

declare @sql varchar(1024)
declare curs cursor for
select 'ALTER TABLE "'+tab.name+'" DROP CONSTRAINT '+cons.name
from sys.objects cons,sys.objects tab
where cons.type in ('C', 'F', 'PK', 'UQ', 'D')
and cons.parent_object_id=tab.object_id and tab.type='U'
order by cons.type

open curs
fetch next from curs into @sql
while (@@fetch_status = 0)
begin
print @sql
exec(@sql)
fetch next from curs into @sql
end
close curs
deallocate curs



然后删除所有tables

declare @sql varchar(1024)
declare curs cursor for
select 'DROP TABLE "'+tab.name+'";'
from sys.objects cons,sys.objects tab
where cons.type in ('C', 'F', 'PK', 'UQ', 'D')
and cons.parent_object_id=tab.object_id and tab.type='U'
order by cons.type

open curs
fetch next from curs into @sql
while (@@fetch_status = 0)
begin
print @sql
exec(@sql)
fetch next from curs into @sql
end
close curs


或者用下列方式

declare @c int begin
begin if object_id('ADMINCONFIG_SUPERGROUPS') is not null begin drop table [ADMINCONFIG_SUPERGROUPS] end SET @c = 0;end
begin if object_id('ADMINCONFIG_SUPERUSERS') is not null begin drop table [ADMINCONFIG_SUPERUSERS] end SET @c = 0;end
begin if object_id('ADMINCONFIG') is not null begin drop table [ADMINCONFIG] end SET @c = 0;end
begin if object_id('AMFAPPLICATIONREVISION') is not null begin drop table [AMFAPPLICATIONREVISION] end SET @c = 0;end
begin if object_id('AMXADMINUSERPREFERENCES') is not null begin drop table [AMXADMINUSERPREFERENCES] end SET @c = 0;end
begin if object_id('AMXDMINSRPRFRENCES_PRPERTYGRPS') is not null begin drop table [AMXDMINSRPRFRENCES_PRPERTYGRPS] end SET @c = 0;end
begin if object_id('APPENDERREF') is not null begin drop table [APPENDERREF] end SET @c = 0;end
begin if object_id('APPFRAGMENT') is not null begin drop table [APPFRAGMENT] end SET @c = 0;end
begin if object_id('APPLICATIONFOLDER') is not null begin drop table [APPLICATIONFOLDER] end SET @c = 0;end
begin if object_id('APPLICATION') is not null begin drop table [APPLICATION] end SET @c = 0;end
begin if object_id('BASECOMPONENT_APPFRAGMENTS') is not null begin drop table [BASECOMPONENT_APPFRAGMENTS] end SET @c = 0;end
begin if object_id('BASECOMPONENT_POLICYINTENTS') is not null begin drop table [BASECOMPONENT_POLICYINTENTS] end SET @c = 0;end
begin if object_id('BASECOMPONENT') is not null begin drop table [BASECOMPONENT] end SET @c = 0;end
begin if object_id('BINDING_APPFRAGMENTS') is not null begin drop table [BINDING_APPFRAGMENTS] end SET @c = 0;end
begin if object_id('BINDING_APPLICATIONLOGGERS') is not null begin drop table [BINDING_APPLICATIONLOGGERS] end SET @c = 0;end
begin if object_id('BINDING_INCLUDEDRESOURCES') is not null begin drop table [BINDING_INCLUDEDRESOURCES] end SET @c = 0;end
begin if object_id('BINDING_NODELOGGERS') is not null begin drop table [BINDING_NODELOGGERS] end SET @c = 0;end
begin if object_id('BINDING_PARENTSOURCECOMPONENT') is not null begin drop table [BINDING_PARENTSOURCECOMPONENT] end SET @c = 0;end
begin if object_id('BINDING_POLICYINTENTS') is not null begin drop table [BINDING_POLICYINTENTS] end SET @c = 0;end
begin if object_id('BINDING_SVARSUSED') is not null begin drop table [BINDING_SVARSUSED] end SET @c = 0;end
begin if object_id('BINDING') is not null begin drop table [BINDING] end SET @c = 0;end
begin if object_id('BNDING') is not null begin drop table [BNDING] end SET @c = 0;end
begin if object_id('BUNDLELIST') is not null begin drop table [BUNDLELIST] end SET @c = 0;end
begin if object_id('CAPABILITYLINK') is not null begin drop table [CAPABILITYLINK] end SET @c = 0;end
begin if object_id('CAPABILITYPROPAGATION') is not null begin drop table [CAPABILITYPROPAGATION] end SET @c = 0;end
begin if object_id('CERTIFICATE') is not null begin drop table [CERTIFICATE] end SET @c = 0;end
begin if object_id('CLUSTER_HOSTS') is not null begin drop table [CLUSTER_HOSTS] end SET @c = 0;end
begin if object_id('CMPNNTINSTNCE_DEPENDSNCMPNENTS') is not null begin drop table [CMPNNTINSTNCE_DEPENDSNCMPNENTS] end SET @c = 0;end
begin if object_id('CMPNNTNSTNC_DPNDSNCMPNNTSCRSSN') is not null begin drop table [CMPNNTNSTNC_DPNDSNCMPNNTSCRSSN] end SET @c = 0;end
begin if object_id('COMPONENTINSTANCESET_ITEMS') is not null begin drop table [COMPONENTINSTANCESET_ITEMS] end SET @c = 0;end
begin if object_id('COMPONENTINSTANCESET') is not null begin drop table [COMPONENTINSTANCESET] end SET @c = 0;end
begin if object_id('COMPONENTINSTANCE') is not null begin drop table [COMPONENTINSTANCE] end SET @c = 0;end
begin if object_id('COMPONENTSUMMARY') is not null begin drop table [COMPONENTSUMMARY] end SET @c = 0;end
begin if object_id('COMPONENT_APPLICATIONLOGGERS') is not null begin drop table [COMPONENT_APPLICATIONLOGGERS] end SET @c = 0;end
begin if object_id('COMPONENT_NODELOGGERS') is not null begin drop table [COMPONENT_NODELOGGERS] end SET @c = 0;end
begin if object_id('CONTEXTPARAMETERS') is not null begin drop table [CONTEXTPARAMETERS] end SET @c = 0;end
begin if object_id('CPBILITYLINK_REQIREDCMPNENTRIS') is not null begin drop table [CPBILITYLINK_REQIREDCMPNENTRIS] end SET @c = 0;end
begin if object_id('CPBLTYLNK_RQRDCMPNNTRISCRSSNDS') is not null begin drop table [CPBLTYLNK_RQRDCMPNNTRISCRSSNDS] end SET @c = 0;end
begin if object_id('CREDENTIALSERVERCONFIG') is not null begin drop table [CREDENTIALSERVERCONFIG] end SET @c = 0;end
begin if object_id('CREDENTIALSERVER') is not null begin drop table [CREDENTIALSERVER] end SET @c = 0;end
begin if object_id('CSR') is not null begin drop table [CSR] end SET @c = 0;end
begin if object_id('DEBUGGEROBJECT') is not null begin drop table [DEBUGGEROBJECT] end SET @c = 0;end
begin if object_id('DEPLOYMENTCONSTRAINT') is not null begin drop table [DEPLOYMENTCONSTRAINT] end SET @c = 0;end
begin if object_id('ENDPINT_DPNDSNCMPNENTSCRSSNDES') is not null begin drop table [ENDPINT_DPNDSNCMPNENTSCRSSNDES] end SET @c = 0;end
begin if object_id('ENDPOINT_DEPENDSONCOMPONENTS') is not null begin drop table [ENDPOINT_DEPENDSONCOMPONENTS] end SET @c = 0;end
begin if object_id('ENDPOINT') is not null begin drop table [ENDPOINT] end SET @c = 0;end
begin if object_id('ENTERPRISECREDENTIALSERVER') is not null begin drop table [ENTERPRISECREDENTIALSERVER] end SET @c = 0;end
begin if object_id('ENVIRONMENT_HOSTS') is not null begin drop table [ENVIRONMENT_HOSTS] end SET @c = 0;end
begin if object_id('ENVIRONMENT_RESOURCETEMPLATES') is not null begin drop table [ENVIRONMENT_RESOURCETEMPLATES] end SET @c = 0;end
begin if object_id('ENVIRONMENT') is not null begin drop table [ENVIRONMENT] end SET @c = 0;end
begin if object_id('ERRORDETAIL') is not null begin drop table [ERRORDETAIL] end SET @c = 0;end
begin if object_id('EXTENSIONPOINTTYPE') is not null begin drop table [EXTENSIONPOINTTYPE] end SET @c = 0;end
begin if object_id('EXTENSIONTYPE') is not null begin drop table [EXTENSIONTYPE] end SET @c = 0;end
begin if object_id('FEATUREID') is not null begin drop table [FEATUREID] end SET @c = 0;end
begin if object_id('FEATURELIST') is not null begin drop table [FEATURELIST] end SET @c = 0;end
begin if object_id('FILTERSECTIONGROUP') is not null begin drop table [FILTERSECTIONGROUP] end SET @c = 0;end
begin if object_id('FILTERSECTION') is not null begin drop table [FILTERSECTION] end SET @c = 0;end
begin if object_id('GADGETCOLUMN') is not null begin drop table [GADGETCOLUMN] end SET @c = 0;end
begin if object_id('HOSTTRANSPORT') is not null begin drop table [HOSTTRANSPORT] end SET @c = 0;end
begin if object_id('JAVAPROCESSCONFIG') is not null begin drop table [JAVAPROCESSCONFIG] end SET @c = 0;end
begin if object_id('JCACONFIG') is not null begin drop table [JCACONFIG] end SET @c = 0;end
begin if object_id('KEYSTORE') is not null begin drop table [KEYSTORE] end SET @c = 0;end
begin if object_id('KEYVALUEPAIR') is not null begin drop table [KEYVALUEPAIR] end SET @c = 0;end
begin if object_id('LOGAPPENDER_SVARSUSED') is not null begin drop table [LOGAPPENDER_SVARSUSED] end SET @c = 0;end
begin if object_id('LOGGERCONFIG') is not null begin drop table [LOGGERCONFIG] end SET @c = 0;end
begin if object_id('LOGICALNODE_BINDINGS') is not null begin drop table [LOGICALNODE_BINDINGS] end SET @c = 0;end
begin if object_id('LOGICALNODE_COMPONENTS') is not null begin drop table [LOGICALNODE_COMPONENTS] end SET @c = 0;end
begin if object_id('LOGICALNODE_PHYSICALNODES') is not null begin drop table [LOGICALNODE_PHYSICALNODES] end SET @c = 0;end
begin if object_id('LOGICALNODE') is not null begin drop table [LOGICALNODE] end SET @c = 0;end
begin if object_id('MACHINE') is not null begin drop table [MACHINE] end SET @c = 0;end
begin if object_id('NAMEDRESOURCEINSTANCE') is not null begin drop table [NAMEDRESOURCEINSTANCE] end SET @c = 0;end
begin if object_id('NDE') is not null begin drop table [NDE] end SET @c = 0;end
begin if object_id('NODETEMPLATE') is not null begin drop table [NODETEMPLATE] end SET @c = 0;end
begin if object_id('NODETYPEFEATURELIST') is not null begin drop table [NODETYPEFEATURELIST] end SET @c = 0;end
begin if object_id('NODE_APPFRAGMENTS') is not null begin drop table [NODE_APPFRAGMENTS] end SET @c = 0;end
begin if object_id('NODE') is not null begin drop table [NODE] end SET @c = 0;end
begin if object_id('NOTIFICATIONTRANSPORT') is not null begin drop table [NOTIFICATIONTRANSPORT] end SET @c = 0;end
begin if object_id('OBJECTTYPECLMNS_IDPRPERTYNAMES') is not null begin drop table [OBJECTTYPECLMNS_IDPRPERTYNAMES] end SET @c = 0;end
begin if object_id('OBJECTTYPECOLUMNS') is not null begin drop table [OBJECTTYPECOLUMNS] end SET @c = 0;end
begin if object_id('PERMISSION') is not null begin drop table [PERMISSION] end SET @c = 0;end
begin if object_id('PLATFORM_NODES') is not null begin drop table [PLATFORM_NODES] end SET @c = 0;end
begin if object_id('PLATFORM_PERMISSIONS') is not null begin drop table [PLATFORM_PERMISSIONS] end SET @c = 0;end
begin if object_id('PLATFORM') is not null begin drop table [PLATFORM] end SET @c = 0;end
begin if object_id('PLUGINCOMPONENT') is not null begin drop table [PLUGINCOMPONENT] end SET @c = 0;end
begin if object_id('PLUGINFEATURE') is not null begin drop table [PLUGINFEATURE] end SET @c = 0;end
begin if object_id('PLUGINSTATEONNODE') is not null begin drop table [PLUGINSTATEONNODE] end SET @c = 0;end
begin if object_id('PLUGINTYPE1') is not null begin drop table [PLUGINTYPE1] end SET @c = 0;end
begin if object_id('POLICYSET') is not null begin drop table [POLICYSET] end SET @c = 0;end
begin if object_id('PRDPPAPPLICTIN_DISTRIBTEDTAPPS') is not null begin drop table [PRDPPAPPLICTIN_DISTRIBTEDTAPPS] end SET @c = 0;end
begin if object_id('PREVIOUSENVSELECTION') is not null begin drop table [PREVIOUSENVSELECTION] end SET @c = 0;end
begin if object_id('PROMOTEDSERVICE') is not null begin drop table [PROMOTEDSERVICE] end SET @c = 0;end
begin if object_id('PROPERTYAMF') is not null begin drop table [PROPERTYAMF] end SET @c = 0;end
begin if object_id('PROVIDEDCAPABILITY') is not null begin drop table [PROVIDEDCAPABILITY] end SET @c = 0;end
begin if object_id('PRPGTNFRMMPLMNTTNTY_PRVDDVRSNS') is not null begin drop table [PRPGTNFRMMPLMNTTNTY_PRVDDVRSNS] end SET @c = 0;end
begin if object_id('PRPGTNFRMXTNSNPNT_PRVIDDVRSINS') is not null begin drop table [PRPGTNFRMXTNSNPNT_PRVIDDVRSINS] end SET @c = 0;end
begin if object_id('PUBLICATIONERROR') is not null begin drop table [PUBLICATIONERROR] end SET @c = 0;end
begin if object_id('PUBLICATION') is not null begin drop table [PUBLICATION] end SET @c = 0;end
begin if object_id('REFERENCE_OPERATIONS') is not null begin drop table [REFERENCE_OPERATIONS] end SET @c = 0;end
begin if object_id('REFERENCE_POLICYINTENTS') is not null begin drop table [REFERENCE_POLICYINTENTS] end SET @c = 0;end
begin if object_id('REFERENCE_PROMOTES') is not null begin drop table [REFERENCE_PROMOTES] end SET @c = 0;end
begin if object_id('REFERENCE') is not null begin drop table [REFERENCE] end SET @c = 0;end
begin if object_id('RELEASEUNITDEPENDENCY') is not null begin drop table [RELEASEUNITDEPENDENCY] end SET @c = 0;end
begin if object_id('REQUIREDCAPABILITY_WITHS') is not null begin drop table [REQUIREDCAPABILITY_WITHS] end SET @c = 0;end
begin if object_id('REQUIREDCAPABILITY') is not null begin drop table [REQUIREDCAPABILITY] end SET @c = 0;end
begin if object_id('RESADAPTERRARASSOCIATIONS') is not null begin drop table [RESADAPTERRARASSOCIATIONS] end SET @c = 0;end
begin if object_id('RESORCEINSTANCE_ATOCREATEDREFS') is not null begin drop table [RESORCEINSTANCE_ATOCREATEDREFS] end SET @c = 0;end
begin if object_id('RESORCETEMPLATE_ATOCREATEDREFS') is not null begin drop table [RESORCETEMPLATE_ATOCREATEDREFS] end SET @c = 0;end
begin if object_id('RESOURCEADAPTERLIST') is not null begin drop table [RESOURCEADAPTERLIST] end SET @c = 0;end
begin if object_id('RESOURCEINSTANCE') is not null begin drop table [RESOURCEINSTANCE] end SET @c = 0;end
begin if object_id('RESOURCETEMPLATE_DEPENDENCIES') is not null begin drop table [RESOURCETEMPLATE_DEPENDENCIES] end SET @c = 0;end
begin if object_id('RESOURCETEMPLATE_SVARSUSED') is not null begin drop table [RESOURCETEMPLATE_SVARSUSED] end SET @c = 0;end
begin if object_id('RESOURCETEMPLATE') is not null begin drop table [RESOURCETEMPLATE] end SET @c = 0;end
begin if object_id('SBSTITUTIONVARIABLE_VISIBILITY') is not null begin drop table [SBSTITUTIONVARIABLE_VISIBILITY] end SET @c = 0;end
begin if object_id('SERVERCFG_PUBLICATIONS') is not null begin drop table [SERVERCFG_PUBLICATIONS] end SET @c = 0;end
begin if object_id('SERVERCFG') is not null begin drop table [SERVERCFG] end SET @c = 0;end
begin if object_id('SERVICEVIRTUALIZATION') is not null begin drop table [SERVICEVIRTUALIZATION] end SET @c = 0;end
begin if object_id('SERVICE_OPERATIONS') is not null begin drop table [SERVICE_OPERATIONS] end SET @c = 0;end
begin if object_id('SERVICE_POLICYINTENTS') is not null begin drop table [SERVICE_POLICYINTENTS] end SET @c = 0;end
begin if object_id('SERVICE') is not null begin drop table [SERVICE] end SET @c = 0;end
begin if object_id('SILVERLIGHTLAYOUT') is not null begin drop table [SILVERLIGHTLAYOUT] end SET @c = 0;end
begin if object_id('STRINGTOLONGMAPENTRY') is not null begin drop table [STRINGTOLONGMAPENTRY] end SET @c = 0;end
begin if object_id('STRINGTOSTRINGMAPENTRY') is not null begin drop table [STRINGTOSTRINGMAPENTRY] end SET @c = 0;end
begin if object_id('SUBSTITUTABLEOBJECT') is not null begin drop table [SUBSTITUTABLEOBJECT] end SET @c = 0;end
begin if object_id('SUBSTITUTIONBINDING') is not null begin drop table [SUBSTITUTIONBINDING] end SET @c = 0;end
begin if object_id('SUBSTITUTIONVARIABLES') is not null begin drop table [SUBSTITUTIONVARIABLES] end SET @c = 0;end
begin if object_id('SUBSTITUTIONVARIABLE') is not null begin drop table [SUBSTITUTIONVARIABLE] end SET @c = 0;end
begin if object_id('SVARRESOLVED') is not null begin drop table [SVARRESOLVED] end SET @c = 0;end
begin if object_id('SVARSUSED') is not null begin drop table [SVARSUSED] end SET @c = 0;end
begin if object_id('TAG') is not null begin drop table [TAG] end SET @c = 0;end
begin if object_id('TASKRESULT_TASKDEPENDENCIES') is not null begin drop table [TASKRESULT_TASKDEPENDENCIES] end SET @c = 0;end
begin if object_id('TASKRESULT') is not null begin drop table [TASKRESULT] end SET @c = 0;end
begin if object_id('TASK_DEPENDENCIES') is not null begin drop table [TASK_DEPENDENCIES] end SET @c = 0;end
begin if object_id('TASK_PROCESSEDDEPENDENCIES') is not null begin drop table [TASK_PROCESSEDDEPENDENCIES] end SET @c = 0;end
begin if object_id('TASK') is not null begin drop table [TASK] end SET @c = 0;end
begin if object_id('TCSUSER') is not null begin drop table [TCSUSER] end SET @c = 0;end
begin if object_id('UIVIEW') is not null begin drop table [UIVIEW] end SET @c = 0;end
begin if object_id('USERACTION_USERACTIONENTITYIDS') is not null begin drop table [USERACTION_USERACTIONENTITYIDS] end SET @c = 0;end
begin if object_id('USERACTION') is not null begin drop table [USERACTION] end SET @c = 0;end
begin if object_id('USERPREFPROPERTYGROUP') is not null begin drop table [USERPREFPROPERTYGROUP] end SET @c = 0;end
begin if object_id('USERPREFPROPERTY') is not null begin drop table [USERPREFPROPERTY] end SET @c = 0;end
begin if object_id('USERPREFPRPERTYGROP_PROPERTIES') is not null begin drop table [USERPREFPRPERTYGROP_PROPERTIES] end SET @c = 0;end
begin if object_id('USERSEARCHQUERY') is not null begin drop table [USERSEARCHQUERY] end SET @c = 0;end
begin if object_id('VERSIONCLOSURE') is not null begin drop table [VERSIONCLOSURE] end SET @c = 0;end
begin if object_id('WIRE') is not null begin drop table [WIRE] end SET @c = 0;end
begin if object_id('COMPLEXITYREQS') is not null begin drop table [COMPLEXITYREQS] end SET @c = 0;end
begin if object_id('GROUP_CHILDGROUPS') is not null begin drop table [GROUP_CHILDGROUPS] end SET @c = 0;end
begin if object_id('GROUP_USERS') is not null begin drop table [GROUP_USERS] end SET @c = 0;end
begin if object_id('GROUP') is not null begin drop table [GROUP] end SET @c = 0;end
begin if object_id('HASHEDPASSWORD') is not null begin drop table [HASHEDPASSWORD] end SET @c = 0;end
begin if object_id('PASSWORDHISTORY') is not null begin drop table [PASSWORDHISTORY] end SET @c = 0;end
begin if object_id('PASSWORDPOLICY') is not null begin drop table [PASSWORDPOLICY] end SET @c = 0;end
begin if object_id('REALM') is not null begin drop table [REALM] end SET @c = 0;end
begin if object_id('USER') is not null begin drop table [USER] end SET @c = 0;end
begin if object_id('ACTIONEXECUTION') is not null begin drop table [ACTIONEXECUTION] end SET @c = 0;end
begin if object_id('AGGREGATEINFO_RESETCONDITIONS') is not null begin drop table [AGGREGATEINFO_RESETCONDITIONS] end SET @c = 0;end
begin if object_id('AGGRGTREVNTDFINITIN_METRICGRPS') is not null begin drop table [AGGRGTREVNTDFINITIN_METRICGRPS] end SET @c = 0;end
begin if object_id('AGGRGTRMDLS_RQIRDGGRGTRXTNSINS') is not null begin drop table [AGGRGTRMDLS_RQIRDGGRGTRXTNSINS] end SET @c = 0;end
begin if object_id('AGGRGTRVNTDFNTNX_TMSYNCHRNZDBY') is not null begin drop table [AGGRGTRVNTDFNTNX_TMSYNCHRNZDBY] end SET @c = 0;end
begin if object_id('BASEACTION_PROVIDEDINTENTS') is not null begin drop table [BASEACTION_PROVIDEDINTENTS] end SET @c = 0;end
begin if object_id('BASEACTION') is not null begin drop table [BASEACTION] end SET @c = 0;end
begin if object_id('BASEECA') is not null begin drop table [BASEECA] end SET @c = 0;end
begin if object_id('BASEPARAMSETTING') is not null begin drop table [BASEPARAMSETTING] end SET @c = 0;end
begin if object_id('BASEVAL') is not null begin drop table [BASEVAL] end SET @c = 0;end
begin if object_id('BUNDLEDGCINSTANCE') is not null begin drop table [BUNDLEDGCINSTANCE] end SET @c = 0;end
begin if object_id('CHOICE') is not null begin drop table [CHOICE] end SET @c = 0;end
begin if object_id('DEPLOYABLE') is not null begin drop table [DEPLOYABLE] end SET @c = 0;end
begin if object_id('DEPLOYMENTFRAGMENT') is not null begin drop table [DEPLOYMENTFRAGMENT] end SET @c = 0;end
begin if object_id('DPLYMNTFRGMNT_PPLICTINTEMPLTES') is not null begin drop table [DPLYMNTFRGMNT_PPLICTINTEMPLTES] end SET @c = 0;end
begin if object_id('ENFORCEMENTPLACEMENT') is not null begin drop table [ENFORCEMENTPLACEMENT] end SET @c = 0;end
begin if object_id('ENFORCEMENTPOINTPLACEMENT') is not null begin drop table [ENFORCEMENTPOINTPLACEMENT] end SET @c = 0;end
begin if object_id('ENFORCEMENTSECTIONPLACEMENT') is not null begin drop table [ENFORCEMENTSECTIONPLACEMENT] end SET @c = 0;end
begin if object_id('ENFORCEMENTSTAGEPLACEMENT') is not null begin drop table [ENFORCEMENTSTAGEPLACEMENT] end SET @c = 0;end
begin if object_id('EVENTTARGETEXTENSIN_METRICGRPS') is not null begin drop table [EVENTTARGETEXTENSIN_METRICGRPS] end SET @c = 0;end
begin if object_id('EVENTTARGET_METRICGROUPS') is not null begin drop table [EVENTTARGET_METRICGROUPS] end SET @c = 0;end
begin if object_id('EVENTTARGET_TARGETTYPES') is not null begin drop table [EVENTTARGET_TARGETTYPES] end SET @c = 0;end
begin if object_id('EVENTTRGETEXTENSIN_TARGETTYPES') is not null begin drop table [EVENTTRGETEXTENSIN_TARGETTYPES] end SET @c = 0;end
begin if object_id('GOVERNEDDOMAINDEFINITION') is not null begin drop table [GOVERNEDDOMAINDEFINITION] end SET @c = 0;end
begin if object_id('GOVERNEDENTERPRISE') is not null begin drop table [GOVERNEDENTERPRISE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTCHILDREN_VALUE') is not null begin drop table [GOVERNEDOBJECTCHILDREN_VALUE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTCHILDREN') is not null begin drop table [GOVERNEDOBJECTCHILDREN] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTPARENT') is not null begin drop table [GOVERNEDOBJECTPARENT] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTPROPERTYDEF') is not null begin drop table [GOVERNEDOBJECTPROPERTYDEF] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTPROPERTY') is not null begin drop table [GOVERNEDOBJECTPROPERTY] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTREFERENCEDEF') is not null begin drop table [GOVERNEDOBJECTREFERENCEDEF] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTREFERENCE_VALUE') is not null begin drop table [GOVERNEDOBJECTREFERENCE_VALUE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTREFERENCE') is not null begin drop table [GOVERNEDOBJECTREFERENCE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTTYPE_SUPERTYPE') is not null begin drop table [GOVERNEDOBJECTTYPE_SUPERTYPE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECTTYPE') is not null begin drop table [GOVERNEDOBJECTTYPE] end SET @c = 0;end
begin if object_id('GOVERNEDOBJECT') is not null begin drop table [GOVERNEDOBJECT] end SET @c = 0;end
begin if object_id('GVERNEDBJECTPARENTREFERENCEDEF') is not null begin drop table [GVERNEDBJECTPARENTREFERENCEDEF] end SET @c = 0;end
begin if object_id('GVERNNCERLECTIN_PRVIDEDINTENTS') is not null begin drop table [GVERNNCERLECTIN_PRVIDEDINTENTS] end SET @c = 0;end
begin if object_id('GVRNNCRLCTINTMPLT_PRVIDDINTNTS') is not null begin drop table [GVRNNCRLCTINTMPLT_PRVIDDINTNTS] end SET @c = 0;end
begin if object_id('METRICDEFINITINEXTENSIN_LIASES') is not null begin drop table [METRICDEFINITINEXTENSIN_LIASES] end SET @c = 0;end
begin if object_id('METRICDEFINITION_ALIASES') is not null begin drop table [METRICDEFINITION_ALIASES] end SET @c = 0;end
begin if object_id('METRICDEFINITION_TIMEWINDOWSET') is not null begin drop table [METRICDEFINITION_TIMEWINDOWSET] end SET @c = 0;end
begin if object_id('METRICGROP_GOVERNEDOBJECTGROPS') is not null begin drop table [METRICGROP_GOVERNEDOBJECTGROPS] end SET @c = 0;end
begin if object_id('METRICGROUP_TIMEWINDOWSET') is not null begin drop table [METRICGROUP_TIMEWINDOWSET] end SET @c = 0;end
begin if object_id('METRICGRPEXTENSIN_TIMEWINDWSET') is not null begin drop table [METRICGRPEXTENSIN_TIMEWINDWSET] end SET @c = 0;end
begin if object_id('METRICGRP_PPLICABLECLASSIFIERS') is not null begin drop table [METRICGRP_PPLICABLECLASSIFIERS] end SET @c = 0;end
begin if object_id('MODELBLOB') is not null begin drop table [MODELBLOB] end SET @c = 0;end
begin if object_id('MODELOBJECTID') is not null begin drop table [MODELOBJECTID] end SET @c = 0;end
begin if object_id('MTRCGRPXTNSIN_PPLICBLCLSSIFIRS') is not null begin drop table [MTRCGRPXTNSIN_PPLICBLCLSSIFIRS] end SET @c = 0;end
begin if object_id('MTRICDFINITINXTNSIN_TIMWINDWST') is not null begin drop table [MTRICDFINITINXTNSIN_TIMWINDWST] end SET @c = 0;end
begin if object_id('MTRICGRPEXTNSIN_GVRNDBJECTGRPS') is not null begin drop table [MTRICGRPEXTNSIN_GVRNDBJECTGRPS] end SET @c = 0;end
begin if object_id('PARAMETERGROUPSETTING') is not null begin drop table [PARAMETERGROUPSETTING] end SET @c = 0;end
begin if object_id('PARAMETERGROUP') is not null begin drop table [PARAMETERGROUP] end SET @c = 0;end
begin if object_id('PARAMETERPROPERTY') is not null begin drop table [PARAMETERPROPERTY] end SET @c = 0;end
begin if object_id('PARAMETER') is not null begin drop table [PARAMETER] end SET @c = 0;end
begin if object_id('PERSISTENCEBASE') is not null begin drop table [PERSISTENCEBASE] end SET @c = 0;end
begin if object_id('PREFIXMAP') is not null begin drop table [PREFIXMAP] end SET @c = 0;end
begin if object_id('PROPERTYFILTER') is not null begin drop table [PROPERTYFILTER] end SET @c = 0;end
begin if object_id('PROPERTYVAL') is not null begin drop table [PROPERTYVAL] end SET @c = 0;end
begin if object_id('QERYCONFIGRATION_TARGETMETRICS') is not null begin drop table [QERYCONFIGRATION_TARGETMETRICS] end SET @c = 0;end
begin if object_id('QRYCNFIGRTINEXTNSIN_TRGTMTRICS') is not null begin drop table [QRYCNFIGRTINEXTNSIN_TRGTMTRICS] end SET @c = 0;end
begin if object_id('RELATIONPATHITEM') is not null begin drop table [RELATIONPATHITEM] end SET @c = 0;end
begin if object_id('RELATIONPATH') is not null begin drop table [RELATIONPATH] end SET @c = 0;end
begin if object_id('RESETCNDITIONEXTENSION_TARGETS') is not null begin drop table [RESETCNDITIONEXTENSION_TARGETS] end SET @c = 0;end
begin if object_id('RESOURCEINSTANCEMAP') is not null begin drop table [RESOURCEINSTANCEMAP] end SET @c = 0;end
begin if object_id('RESOURCETEMPLATEASSOCIATION') is not null begin drop table [RESOURCETEMPLATEASSOCIATION] end SET @c = 0;end
begin if object_id('RSRCETEMPLTESSCITIN_LLWEDTYPES') is not null begin drop table [RSRCETEMPLTESSCITIN_LLWEDTYPES] end SET @c = 0;end
begin if object_id('RSRCTMPLTSSCITIN_RFPRPERTYNMES') is not null begin drop table [RSRCTMPLTSSCITIN_RFPRPERTYNMES] end SET @c = 0;end
begin if object_id('RULEACTION') is not null begin drop table [RULEACTION] end SET @c = 0;end
begin if object_id('RULETEMPLATEREF') is not null begin drop table [RULETEMPLATEREF] end SET @c = 0;end
begin if object_id('RULE_PROVIDEDINTENTS') is not null begin drop table [RULE_PROVIDEDINTENTS] end SET @c = 0;end
begin if object_id('RULE_TAGS') is not null begin drop table [RULE_TAGS] end SET @c = 0;end
begin if object_id('RULE') is not null begin drop table [RULE] end SET @c = 0;end
begin if object_id('SINGLEVAL_REFPROPERTYNAMES') is not null begin drop table [SINGLEVAL_REFPROPERTYNAMES] end SET @c = 0;end
begin if object_id('SINGLPRMSETTING_REFPRPERTYNMES') is not null begin drop table [SINGLPRMSETTING_REFPRPERTYNMES] end SET @c = 0;end
begin if object_id('SUBSTITUTIONVARIABLEREF') is not null begin drop table [SUBSTITUTIONVARIABLEREF] end SET @c = 0;end
begin if object_id('TARGETDEFINITION_TYPES') is not null begin drop table [TARGETDEFINITION_TYPES] end SET @c = 0;end
begin if object_id('TARGETOBJECTGROUPSELECTOR') is not null begin drop table [TARGETOBJECTGROUPSELECTOR] end SET @c = 0;end
begin if object_id('TEMPLATECATEGORY_SUBCATEGORIES') is not null begin drop table [TEMPLATECATEGORY_SUBCATEGORIES] end SET @c = 0;end
begin if object_id('TEMPLATECATEGORY') is not null begin drop table [TEMPLATECATEGORY] end SET @c = 0;end
begin if object_id('TEMPLATE') is not null begin drop table [TEMPLATE] end SET @c = 0;end
begin if object_id('TIMEWINDOWSET_WINDOW') is not null begin drop table [TIMEWINDOWSET_WINDOW] end SET @c = 0;end
begin if object_id('TIMEWINDWSET_GVERNEDOBJECTGRPS') is not null begin drop table [TIMEWINDWSET_GVERNEDOBJECTGRPS] end SET @c = 0;end
begin if object_id('TIMWINDWEXTNSIN_GVRNDBJECTGRPS') is not null begin drop table [TIMWINDWEXTNSIN_GVRNDBJECTGRPS] end SET @c = 0;end
begin if object_id('UNBOUNDEDPARAMSETTING_VALUES') is not null begin drop table [UNBOUNDEDPARAMSETTING_VALUES] end SET @c = 0;end
begin if object_id('UNBOUNDEDVAL_VALUES') is not null begin drop table [UNBOUNDEDVAL_VALUES] end SET @c = 0;end
begin if object_id('VERSIONEDOBJECT') is not null begin drop table [VERSIONEDOBJECT] end SET @c = 0;end
begin if object_id('WNDWHISTRYDFINITIN_RSTCNDITINS') is not null begin drop table [WNDWHISTRYDFINITIN_RSTCNDITINS] end SET @c = 0;end
begin if object_id('ACTIVESTARTTIMES') is not null begin drop table [ACTIVESTARTTIMES] end SET @c = 0;end
begin if object_id('BASEEVENTFORMAT_CLASSIFIERS') is not null begin drop table [BASEEVENTFORMAT_CLASSIFIERS] end SET @c = 0;end
begin if object_id('BASEEVENTFORMAT_PAYLOADIDS') is not null begin drop table [BASEEVENTFORMAT_PAYLOADIDS] end SET @c = 0;end
begin if object_id('BASEEVENTFORMAT') is not null begin drop table [BASEEVENTFORMAT] end SET @c = 0;end
begin if object_id('CLASSIFIERBEFMAP') is not null begin drop table [CLASSIFIERBEFMAP] end SET @c = 0;end
begin if object_id('CLASSIFIERGROUPS') is not null begin drop table [CLASSIFIERGROUPS] end SET @c = 0;end
begin if object_id('CLASSIFIER') is not null begin drop table [CLASSIFIER] end SET @c = 0;end
begin if object_id('CLQUERYMODEL') is not null begin drop table [CLQUERYMODEL] end SET @c = 0;end
begin if object_id('ECOMPID') is not null begin drop table [ECOMPID] end SET @c = 0;end
begin if object_id('LGGINGPOLICYMESSAGE_PROPERTIES') is not null begin drop table [LGGINGPOLICYMESSAGE_PROPERTIES] end SET @c = 0;end
begin if object_id('LOGGINGPOLICYMESSAGE') is not null begin drop table [LOGGINGPOLICYMESSAGE] end SET @c = 0;end
begin if object_id('LOGGINGPOLICYMODEL_MESSAGES') is not null begin drop table [LOGGINGPOLICYMODEL_MESSAGES] end SET @c = 0;end
begin if object_id('LOGGINGPOLICYPROPERTY') is not null begin drop table [LOGGINGPOLICYPROPERTY] end SET @c = 0;end
begin if object_id('LOGSERVICE') is not null begin drop table [LOGSERVICE] end SET @c = 0;end
begin if object_id('OTHERSITUATION_ANY') is not null begin drop table [OTHERSITUATION_ANY] end SET @c = 0;end
begin if object_id('PAYLOADDATA') is not null begin drop table [PAYLOADDATA] end SET @c = 0;end
begin if object_id('PAYLOAD') is not null begin drop table [PAYLOAD] end SET @c = 0;end
begin if object_id('REPORTINGCOMPONENTID') is not null begin drop table [REPORTINGCOMPONENTID] end SET @c = 0;end
begin if object_id('SITUATIONTYPE') is not null begin drop table [SITUATIONTYPE] end SET @c = 0;end
begin if object_id('STATSCLASSIFIERS') is not null begin drop table [STATSCLASSIFIERS] end SET @c = 0;end
begin if object_id('APPLICATIONARTIFACT') is not null begin drop table [APPLICATIONARTIFACT] end SET @c = 0;end
begin if object_id('APPLICATIONARTIFACT_FEATURES') is not null begin drop table [APPLICATIONARTIFACT_FEATURES] end SET @c = 0;end
begin if object_id('APPLICTINRTIFCT_RESRCETEMPLTES') is not null begin drop table [APPLICTINRTIFCT_RESRCETEMPLTES] end SET @c = 0;end
end

猜你喜欢

转载自mxy0521.iteye.com/blog/1711600