[AccessD] On DB Bloat, Bad DB Design, and various

DWUTKA at marlow.com DWUTKA at marlow.com
Thu May 27 15:36:11 CDT 2004


Yep.

LOL.  When I did the change in Enterprise manager, Enterprise manager
created a page and a half long script.  That script actually created a temp
table, sent the data to the temp table, then destroyed the original table,
and changed the name of the temp table.

Here's the script that Enterprise Manager created:

/*    Tuesday, May 11, 2004 12:02:46 PM    User:     Server: DWHOME2000
Database: ********    Application: MS SQLEM - Data Tools */  BEGIN
TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logWorkRelated
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logRecordable
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logNearMiss
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logDeath
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logOccupationalIllness
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logInPatient
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logLeftWork
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logBackToWork
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logOSHAPrivacyConcern
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logHospitalized
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logRestrictedDuty
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logRestrictedDutyRelease
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFinishedTreatment
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logRestrictedDutyCheckupDone
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logEvaluationRequested
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logEvaluationCompleted
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logInitialIncidentReportCompleted
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logTransferOrTerminated
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logDrugScreePerformed
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logTaskRoutine
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logPPERequiredUse
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logShortTermFollowUpCompleted
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logLongTermFollowupCompleted
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFlag_PPE
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFlag_Vehicle
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFlag_Ergononic
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFlag_Law
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logFlag_Claimcost
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logCA1CA2
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logTransferred
GO
ALTER TABLE dbo.tblIncidents
	DROP CONSTRAINT DF_tblIncidents_I_logOnEmployersPremises
GO
CREATE TABLE dbo.Tmp_tblIncidents
	(
	I_pk_Incident int NOT NULL IDENTITY (1, 1) NOT FOR REPLICATION,
	I_txtCaseNumber nvarchar(25) NULL,
	I_datDateAddedToTable datetime NULL,
	I_txtCaseCode nvarchar(5) NULL,
	I_txtCaseYear nvarchar(2) NULL,
	I_txtCaseCount nvarchar(4) NULL,
	I_txtPersonID nvarchar(11) NULL,
	I_txtSocialSecurityNumber nvarchar(11) NULL,
	I_txtPersonFullName nvarchar(50) NULL,
	I_txtFirstName nvarchar(15) NULL,
	I_txtMiddleName nvarchar(10) NULL,
	I_txtLastName nvarchar(15) NULL,
	I_txtStreetAddress1 nvarchar(50) NULL,
	I_txtStreetAddress2 nvarchar(50) NULL,
	I_txtCity nvarchar(35) NULL,
	I_txtState nvarchar(2) NULL,
	I_txtZipCode nvarchar(10) NULL,
	I_txtSex nvarchar(1) NULL,
	I_txtCompanyID nvarchar(20) NULL,
	I_txtCompany_Name nvarchar(50) NULL,
	I_txtSiteID nvarchar(10) NULL,
	I_txtSiteName nvarchar(50) NULL,
	I_txtSiteNamePerson nvarchar(50) NULL,
	I_txtHierarchy1 nvarchar(40) NULL,
	I_txtHierarchy2 nvarchar(40) NULL,
	I_txtHierarchy3 nvarchar(40) NULL,
	I_txtHierarchy4 nvarchar(40) NULL,
	I_txtHierarchy5 nvarchar(40) NULL,
	I_txtOrganizationalCode1 nvarchar(15) NULL,
	I_txtOrganizationalCode2 nvarchar(15) NULL,
	I_txtMaritalStatus nvarchar(20) NULL,
	I_datDateOfBirth datetime NULL,
	I_txtHomePhone nvarchar(14) NULL,
	I_txtJobTitle nvarchar(50) NULL,
	I_txtShift nvarchar(50) NULL,
	I_txtShiftDescription nvarchar(50) NULL,
	I_txtPersonnelStatus nvarchar(50) NULL,
	I_txtWorkPhoneNumber nvarchar(14) NULL,
	I_txtEmailAddress nvarchar(50) NULL,
	I_datDateOfHire datetime NULL,
	I_txtMailStop nvarchar(25) NULL,
	I_txtIncidentType nvarchar(40) NULL,
	I_datIncidentDate datetime NULL,
	I_datIncidentTime varchar(50) NULL,
	I_logWorkRelated bit NOT NULL,
	I_logRecordable bit NOT NULL,
	I_logNearMiss bit NOT NULL,
	I_txtSeverityofIncident nvarchar(40) NULL,
	I_txtNatureOfInury nvarchar(40) NULL,
	I_txtBodyPart nvarchar(40) NULL,
	I_txtBodyPartSide nvarchar(10) NULL,
	I_txtBodyPartSecondary nvarchar(40) NULL,
	I_txtSourceOfIncident nvarchar(40) NULL,
	I_txtSecondarySourceOfIncident nvarchar(40) NULL,
	I_txtAccidentEventType nvarchar(40) NULL,
	I_txtRegularJobClass nvarchar(40) NULL,
	I_txtJobClassAtIncident nvarchar(40) NULL,
	I_intHoursWorkedPriorToIncident smallint NULL,
	I_logDeath bit NOT NULL,
	I_datDateOfDeath datetime NULL,
	I_logOccupationalIllness bit NOT NULL,
	I_txtIllnessDescription nvarchar(60) NULL,
	I_txtWorksiteLocation nvarchar(255) NULL,
	I_txtHospitalID nvarchar(5) NULL,
	I_txtHospitalName nvarchar(50) NULL,
	I_logInPatient bit NOT NULL,
	I_txtDoctorID nvarchar(5) NULL,
	I_txtDoctorName nvarchar(40) NULL,
	I_txtSupervisorNotified nvarchar(50) NULL,
	I_txtSupervisorFirstName nvarchar(15) NULL,
	I_txtSupervisorLastName nvarchar(11) NULL,
	I_txtWitnessEmployeeID nvarchar(11) NULL,
	I_txtWitnessFirstName nvarchar(15) NULL,
	I_txtWitnessLastName nvarchar(11) NULL,
	I_datDateNotifiedOfIncident datetime NULL,
	I_datTimeNotifiedOfIncident varchar(50) NULL,
	I_datTimeBeganWork varchar(50) NULL,
	I_logLeftWork bit NOT NULL,
	I_datDateLeftWork datetime NULL,
	I_datTimeLeftWork datetime NULL,
	I_logBackToWork bit NOT NULL,
	I_datDateBackToWork datetime NULL,
	I_datTimeBackToWork datetime NULL,
	I_txtOSHALogDescription nvarchar(60) NULL,
	I_logOSHAPrivacyConcern bit NOT NULL,
	I_txtFirstAidProvidedTime datetime NULL,
	I_txtFirstAidTypeProvided nvarchar(40) NULL,
	I_txtFirstAidPersonFullName nvarchar(25) NULL,
	I_txtFirstAidEmployeeID nvarchar(11) NULL,
	I_txtFirstAidFirstName nvarchar(15) NULL,
	I_txtFirstAidLastName nvarchar(15) NULL,
	I_logHospitalized bit NOT NULL,
	I_datDateOfInitialTreatment datetime NULL,
	I_datTimeAdmittedToHospital datetime NULL,
	I_datDateOutOfHospital datetime NULL,
	I_datTimeOutOfHospital datetime NULL,
	I_intWorkDaysLost smallint NULL,
	I_intChargedDaysLost smallint NULL,
	I_intCalendarDaysLost smallint NULL,
	I_logRestrictedDuty bit NOT NULL,
	I_logRestrictedDutyRelease bit NOT NULL,
	I_intRestrictedDutyDays smallint NULL,
	I_intRestrictedDutyCalendarDays smallint NULL,
	I_logFinishedTreatment bit NOT NULL,
	I_datRestrictedDutyCheckupDate datetime NULL,
	I_logRestrictedDutyCheckupDone bit NOT NULL,
	I_logEvaluationRequested bit NOT NULL,
	I_txtEvaluationType nvarchar(40) NULL,
	I_logEvaluationCompleted bit NOT NULL,
	I_datEvaluationCompletionDate datetime NULL,
	I_datEvaluationFollowupDate datetime NULL,
	I_logInitialIncidentReportCompleted bit NOT NULL,
	I_datReportCirculationDate datetime NULL,
	I_logTransferOrTerminated bit NOT NULL,
	I_intAccidentLocation smallint NULL,
	I_txtAccidentLocationInsurance nvarchar(35) NULL,
	I_logDrugScreePerformed bit NOT NULL,
	I_datDrugScreenPerformedDate datetime NULL,
	I_txtTaskPerformed nvarchar(40) NULL,
	I_txtTaskExperience nvarchar(40) NULL,
	I_logTaskRoutine bit NOT NULL,
	I_txTaskTimeSinceLastPerformed nvarchar(10) NULL,
	I_datTaskLastTrainedOn datetime NULL,
	I_txtTaskTrainerName nvarchar(25) NULL,
	I_logPPERequiredUse bit NOT NULL,
	I_txtPPETypeRequired nvarchar(40) NULL,
	I_txtPPETypeUsed nvarchar(40) NULL,
	I_txtContributingConditions nvarchar(40) NULL,
	I_txtContributingActions nvarchar(40) NULL,
	I_txtEquipmentProcess nvarchar(40) NULL,
	I_txtEquipmentProcessPart nvarchar(40) NULL,
	I_txtJobTrainingDescription nvarchar(40) NULL,
	I_datShortTermCompletionDate datetime NULL,
	I_datShortTermFollowupDate datetime NULL,
	I_logShortTermFollowUpCompleted bit NOT NULL,
	I_datLongTermCompletionDate datetime NULL,
	I_datLongTermFollowupDate datetime NULL,
	I_logLongTermFollowupCompleted bit NOT NULL,
	I_txtSupervisorID nvarchar(11) NULL,
	I_txtSupervisorName nvarchar(35) NULL,
	I_datSupervisorReviewedDate datetime NULL,
	I_txtSupervisorWorkPhoneNumber nvarchar(13) NULL,
	I_txtSupervisorMailStop nvarchar(5) NULL,
	I_txtPlantManagerID nvarchar(11) NULL,
	I_txtPlantManagerName nvarchar(25) NULL,
	I_datPlantManagerReviewDate datetime NULL,
	I_txtSafetyCoordinatorID nvarchar(11) NULL,
	I_txtSafetyCoordinatorName nvarchar(25) NULL,
	I_datSafetyCoordinatorReviewDate datetime NULL,
	I_txtSafetyDirectorID nvarchar(11) NULL,
	I_txtSafetyDirectorName nvarchar(25) NULL,
	I_datSafetyDirectorReviewDate datetime NULL,
	I_logFlag_PPE bit NOT NULL,
	I_logFlag_Vehicle bit NOT NULL,
	I_logFlag_Ergononic bit NOT NULL,
	I_logFlag_Law bit NOT NULL,
	I_logFlag_Claimcost bit NOT NULL,
	I_logCA1CA2 bit NOT NULL,
	I_Tag nvarchar(50) NULL,
	I_intYear smallint NULL,
	I_txtMonth nvarchar(2) NULL,
	I_datDateLastUpdated datetime NULL,
	I_logTransferred bit NOT NULL,
	I_curTotalCost money NULL,
	I_curTotalInitialReserves money NULL,
	I_logOnEmployersPremises bit NOT NULL,
	I_CurDemand money NULL,
	I_txtAssigned nvarchar(50) NULL,
	I_txtBenefits nvarchar(50) NULL,
	I_txtRepresentation nvarchar(50) NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logWorkRelated DEFAULT (0) FOR I_logWorkRelated
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logRecordable DEFAULT (0) FOR I_logRecordable
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logNearMiss DEFAULT (0) FOR I_logNearMiss
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logDeath DEFAULT (0) FOR I_logDeath
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logOccupationalIllness DEFAULT (0) FOR
I_logOccupationalIllness
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logInPatient DEFAULT (0) FOR I_logInPatient
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logLeftWork DEFAULT (0) FOR I_logLeftWork
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logBackToWork DEFAULT (0) FOR I_logBackToWork
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logOSHAPrivacyConcern DEFAULT (0) FOR
I_logOSHAPrivacyConcern
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logHospitalized DEFAULT (0) FOR I_logHospitalized
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logRestrictedDuty DEFAULT (0) FOR
I_logRestrictedDuty
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logRestrictedDutyRelease DEFAULT (0) FOR
I_logRestrictedDutyRelease
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFinishedTreatment DEFAULT (0) FOR
I_logFinishedTreatment
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logRestrictedDutyCheckupDone DEFAULT (0) FOR
I_logRestrictedDutyCheckupDone
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logEvaluationRequested DEFAULT (0) FOR
I_logEvaluationRequested
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logEvaluationCompleted DEFAULT (0) FOR
I_logEvaluationCompleted
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logInitialIncidentReportCompleted DEFAULT (0) FOR
I_logInitialIncidentReportCompleted
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logTransferOrTerminated DEFAULT (0) FOR
I_logTransferOrTerminated
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logDrugScreePerformed DEFAULT (0) FOR
I_logDrugScreePerformed
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logTaskRoutine DEFAULT (0) FOR I_logTaskRoutine
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logPPERequiredUse DEFAULT (0) FOR
I_logPPERequiredUse
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logShortTermFollowUpCompleted DEFAULT (0) FOR
I_logShortTermFollowUpCompleted
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logLongTermFollowupCompleted DEFAULT (0) FOR
I_logLongTermFollowupCompleted
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFlag_PPE DEFAULT (0) FOR I_logFlag_PPE
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFlag_Vehicle DEFAULT (0) FOR I_logFlag_Vehicle
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFlag_Ergononic DEFAULT (0) FOR
I_logFlag_Ergononic
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFlag_Law DEFAULT (0) FOR I_logFlag_Law
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logFlag_Claimcost DEFAULT (0) FOR
I_logFlag_Claimcost
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logCA1CA2 DEFAULT (0) FOR I_logCA1CA2
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logTransferred DEFAULT (0) FOR I_logTransferred
GO
ALTER TABLE dbo.Tmp_tblIncidents ADD CONSTRAINT
	DF_tblIncidents_I_logOnEmployersPremises DEFAULT (0) FOR
I_logOnEmployersPremises
GO
SET IDENTITY_INSERT dbo.Tmp_tblIncidents ON
GO
IF EXISTS(SELECT * FROM dbo.tblIncidents)
	 EXEC('INSERT INTO dbo.Tmp_tblIncidents (I_pk_Incident,
I_txtCaseNumber, I_datDateAddedToTable, I_txtCaseCode, I_txtCaseYear,
I_txtCaseCount, I_txtPersonID, I_txtSocialSecurityNumber,
I_txtPersonFullName, I_txtFirstName, I_txtMiddleName, I_txtLastName,
I_txtStreetAddress1, I_txtStreetAddress2, I_txtCity, I_txtState,
I_txtZipCode, I_txtSex, I_txtCompanyID, I_txtCompany_Name, I_txtSiteID,
I_txtSiteName, I_txtSiteNamePerson, I_txtHierarchy1, I_txtHierarchy2,
I_txtHierarchy3, I_txtHierarchy4, I_txtHierarchy5, I_txtOrganizationalCode1,
I_txtOrganizationalCode2, I_txtMaritalStatus, I_datDateOfBirth,
I_txtHomePhone, I_txtJobTitle, I_txtShift, I_txtShiftDescription,
I_txtPersonnelStatus, I_txtWorkPhoneNumber, I_txtEmailAddress,
I_datDateOfHire, I_txtMailStop, I_txtIncidentType, I_datIncidentDate,
I_datIncidentTime, I_logWorkRelated, I_logRecordable, I_logNearMiss,
I_txtSeverityofIncident, I_txtNatureOfInury, I_txtBodyPart,
I_txtBodyPartSide, I_txtBodyPartSecondary, I_txtSourceOfIncident,
I_txtSecondarySourceOfIncident, I_txtAccidentEventType,
I_txtRegularJobClass, I_txtJobClassAtIncident,
I_intHoursWorkedPriorToIncident, I_logDeath, I_datDateOfDeath,
I_logOccupationalIllness, I_txtIllnessDescription, I_txtWorksiteLocation,
I_txtHospitalID, I_txtHospitalName, I_logInPatient, I_txtDoctorID,
I_txtDoctorName, I_txtSupervisorNotified, I_txtSupervisorFirstName,
I_txtSupervisorLastName, I_txtWitnessEmployeeID, I_txtWitnessFirstName,
I_txtWitnessLastName, I_datDateNotifiedOfIncident,
I_datTimeNotifiedOfIncident, I_datTimeBeganWork, I_logLeftWork,
I_datDateLeftWork, I_datTimeLeftWork, I_logBackToWork, I_datDateBackToWork,
I_datTimeBackToWork, I_txtOSHALogDescription, I_logOSHAPrivacyConcern,
I_txtFirstAidProvidedTime, I_txtFirstAidTypeProvided,
I_txtFirstAidPersonFullName, I_txtFirstAidEmployeeID,
I_txtFirstAidFirstName, I_txtFirstAidLastName, I_logHospitalized,
I_datDateOfInitialTreatment, I_datTimeAdmittedToHospital,
I_datDateOutOfHospital, I_datTimeOutOfHospital, I_intWorkDaysLost,
I_intChargedDaysLost, I_intCalendarDaysLost, I_logRestrictedDuty,
I_logRestrictedDutyRelease, I_intRestrictedDutyDays,
I_intRestrictedDutyCalendarDays, I_logFinishedTreatment,
I_datRestrictedDutyCheckupDate, I_logRestrictedDutyCheckupDone,
I_logEvaluationRequested, I_txtEvaluationType, I_logEvaluationCompleted,
I_datEvaluationCompletionDate, I_datEvaluationFollowupDate,
I_logInitialIncidentReportCompleted, I_datReportCirculationDate,
I_logTransferOrTerminated, I_intAccidentLocation,
I_txtAccidentLocationInsurance, I_logDrugScreePerformed,
I_datDrugScreenPerformedDate, I_txtTaskPerformed, I_txtTaskExperience,
I_logTaskRoutine, I_txTaskTimeSinceLastPerformed, I_datTaskLastTrainedOn,
I_txtTaskTrainerName, I_logPPERequiredUse, I_txtPPETypeRequired,
I_txtPPETypeUsed, I_txtContributingConditions, I_txtContributingActions,
I_txtEquipmentProcess, I_txtEquipmentProcessPart,
I_txtJobTrainingDescription, I_datShortTermCompletionDate,
I_datShortTermFollowupDate, I_logShortTermFollowUpCompleted,
I_datLongTermCompletionDate, I_datLongTermFollowupDate,
I_logLongTermFollowupCompleted, I_txtSupervisorID, I_txtSupervisorName,
I_datSupervisorReviewedDate, I_txtSupervisorWorkPhoneNumber,
I_txtSupervisorMailStop, I_txtPlantManagerID, I_txtPlantManagerName,
I_datPlantManagerReviewDate, I_txtSafetyCoordinatorID,
I_txtSafetyCoordinatorName, I_datSafetyCoordinatorReviewDate,
I_txtSafetyDirectorID, I_txtSafetyDirectorName,
I_datSafetyDirectorReviewDate, I_logFlag_PPE, I_logFlag_Vehicle,
I_logFlag_Ergononic, I_logFlag_Law, I_logFlag_Claimcost, I_logCA1CA2, I_Tag,
I_intYear, I_txtMonth, I_datDateLastUpdated, I_logTransferred,
I_curTotalCost, I_curTotalInitialReserves, I_logOnEmployersPremises,
I_CurDemand, I_txtAssigned, I_txtBenefits, I_txtRepresentation)
		SELECT I_pk_Incident, I_txtCaseNumber,
I_datDateAddedToTable, I_txtCaseCode, I_txtCaseYear, I_txtCaseCount,
I_txtPersonID, I_txtSocialSecurityNumber, I_txtPersonFullName,
I_txtFirstName, I_txtMiddleName, I_txtLastName, I_txtStreetAddress1,
I_txtStreetAddress2, I_txtCity, I_txtState, I_txtZipCode, I_txtSex,
I_txtCompanyID, I_txtCompany_Name, I_txtSiteID, I_txtSiteName,
I_txtSiteNamePerson, I_txtHierarchy1, I_txtHierarchy2, I_txtHierarchy3,
I_txtHierarchy4, I_txtHierarchy5, I_txtOrganizationalCode1,
I_txtOrganizationalCode2, I_txtMaritalStatus, I_datDateOfBirth,
I_txtHomePhone, I_txtJobTitle, I_txtShift, I_txtShiftDescription,
I_txtPersonnelStatus, I_txtWorkPhoneNumber, I_txtEmailAddress,
I_datDateOfHire, I_txtMailStop, I_txtIncidentType, I_datIncidentDate,
CONVERT(varchar(50), I_datIncidentTime), I_logWorkRelated, I_logRecordable,
I_logNearMiss, I_txtSeverityofIncident, I_txtNatureOfInury, I_txtBodyPart,
I_txtBodyPartSide, I_txtBodyPartSecondary, I_txtSourceOfIncident,
I_txtSecondarySourceOfIncident, I_txtAccidentEventType,
I_txtRegularJobClass, I_txtJobClassAtIncident,
I_intHoursWorkedPriorToIncident, I_logDeath, I_datDateOfDeath,
I_logOccupationalIllness, I_txtIllnessDescription, I_txtWorksiteLocation,
I_txtHospitalID, I_txtHospitalName, I_logInPatient, I_txtDoctorID,
I_txtDoctorName, I_txtSupervisorNotified, I_txtSupervisorFirstName,
I_txtSupervisorLastName, I_txtWitnessEmployeeID, I_txtWitnessFirstName,
I_txtWitnessLastName, I_datDateNotifiedOfIncident, CONVERT(varchar(50),
I_datTimeNotifiedOfIncident), CONVERT(varchar(50), I_datTimeBeganWork),
I_logLeftWork, I_datDateLeftWork, I_datTimeLeftWork, I_logBackToWork,
I_datDateBackToWork, I_datTimeBackToWork, I_txtOSHALogDescription,
I_logOSHAPrivacyConcern, I_txtFirstAidProvidedTime,
I_txtFirstAidTypeProvided, I_txtFirstAidPersonFullName,
I_txtFirstAidEmployeeID, I_txtFirstAidFirstName, I_txtFirstAidLastName,
I_logHospitalized, I_datDateOfInitialTreatment, I_datTimeAdmittedToHospital,
I_datDateOutOfHospital, I_datTimeOutOfHospital, I_intWorkDaysLost,
I_intChargedDaysLost, I_intCalendarDaysLost, I_logRestrictedDuty,
I_logRestrictedDutyRelease, I_intRestrictedDutyDays,
I_intRestrictedDutyCalendarDays, I_logFinishedTreatment,
I_datRestrictedDutyCheckupDate, I_logRestrictedDutyCheckupDone,
I_logEvaluationRequested, I_txtEvaluationType, I_logEvaluationCompleted,
I_datEvaluationCompletionDate, I_datEvaluationFollowupDate,
I_logInitialIncidentReportCompleted, I_datReportCirculationDate,
I_logTransferOrTerminated, I_intAccidentLocation,
I_txtAccidentLocationInsurance, I_logDrugScreePerformed,
I_datDrugScreenPerformedDate, I_txtTaskPerformed, I_txtTaskExperience,
I_logTaskRoutine, I_txTaskTimeSinceLastPerformed, I_datTaskLastTrainedOn,
I_txtTaskTrainerName, I_logPPERequiredUse, I_txtPPETypeRequired,
I_txtPPETypeUsed, I_txtContributingConditions, I_txtContributingActions,
I_txtEquipmentProcess, I_txtEquipmentProcessPart,
I_txtJobTrainingDescription, I_datShortTermCompletionDate,
I_datShortTermFollowupDate, I_logShortTermFollowUpCompleted,
I_datLongTermCompletionDate, I_datLongTermFollowupDate,
I_logLongTermFollowupCompleted, I_txtSupervisorID, I_txtSupervisorName,
I_datSupervisorReviewedDate, I_txtSupervisorWorkPhoneNumber,
I_txtSupervisorMailStop, I_txtPlantManagerID, I_txtPlantManagerName,
I_datPlantManagerReviewDate, I_txtSafetyCoordinatorID,
I_txtSafetyCoordinatorName, I_datSafetyCoordinatorReviewDate,
I_txtSafetyDirectorID, I_txtSafetyDirectorName,
I_datSafetyDirectorReviewDate, I_logFlag_PPE, I_logFlag_Vehicle,
I_logFlag_Ergononic, I_logFlag_Law, I_logFlag_Claimcost, I_logCA1CA2, I_Tag,
I_intYear, I_txtMonth, I_datDateLastUpdated, I_logTransferred,
I_curTotalCost, I_curTotalInitialReserves, I_logOnEmployersPremises,
I_CurDemand, I_txtAssigned, I_txtBenefits, I_txtRepresentation FROM
dbo.tblIncidents TABLOCKX')
GO
SET IDENTITY_INSERT dbo.Tmp_tblIncidents OFF
GO
DROP TABLE dbo.tblIncidents
GO
EXECUTE sp_rename N'dbo.Tmp_tblIncidents', N'tblIncidents', 'OBJECT'
GO
GRANT SELECT ON dbo.tblIncidents TO AirUser  AS dbo
GRANT UPDATE ON dbo.tblIncidents TO AirUser  AS dbo
GRANT INSERT ON dbo.tblIncidents TO AirUser  AS dbo
GRANT DELETE ON dbo.tblIncidents TO AirUser  AS dbo
COMMIT


Honestly never used ALTER COLUMN before.  I will admit I am still a novice
at SQL Server.  But I can do all of the stuff I need from Enterprise Manager
just fine.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Brett Barabash
Sent: Thursday, May 27, 2004 11:47 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] On DB Bloat, Bad DB Design, and various


So let me get this straight...
You just got paid $150 to do what could have been accomplished with the
following SQL statement:

ALTER TABLE MyTable
ALTER COLUMN MyField varchar(255)

So, can you pass along my name to them?   Heck, I'd be willing to do that
for a mere $75! ;-)




More information about the AccessD mailing list