Hello
I have aproblem ofslowjob
database (sql server 2008 R2)
Report-MemoryConsumptionshows that2,000,000DIRTYPAGESconstituteabout 80% ofthebuffer.
After testingit was discovered that90% ofDIRTYcomesfromDBTEMP.
My question is:How do I clearDIRTY fromDBTEMP
Andhow to avoidsuch a bigDIRTY inthe future
Thank you
dirty pages in tempdb
Access denied to remote Oracle server from job
Hello
I have a LINKED ORACLE server to SQL Server 2008 R2 (SP1). All the linked tables work OK. I wrote a couple of procedures to transfer/update data between my DB on the SQL Server and the Oracle linked server tables.
When running a procedure from a query it works. But when putting the same procedure in a job (scheduled) it returns this error:
#############
Access to the remote server is denied because no login-mapping exists. [SQLSTATE 42000]
#############
How can I map logins in such a case to make this work? Or any other options?
Thx in advance
Miha
Large DB Performance problems when updating schemas
Hi,
I'm facing performance problems updating the schema of large databases in SQLServer 2008 R2 and I can't find a proper solution. I would have thought that this is a fairly common problem so here it goes.
I have a database which is about 700Gb in size. I am going to detail 2 different issues:
EXAMPLE 1: CHANGING A FIELD TYPE
In that Database I have a table with the schema detailed below as Table_TB. This table contains several million records. As you can see there is a column of type TEXT (Comment_FD). What I am trying to do is changing the column type to NVARCHAR(MAX) to
remove the deprecated TEXT type and support UNICODE characters in that field.
The command I am running is the following one:
ALTER TABLE DBA.Table_TB ALTER COLUMN Comment_FD NVARCHAR(MAX)
This operation takes several hours to complete.
I tried the following:
-Adding the new column to the same table and copying the data over
-Creating a new entire table with the new field type modified and copy the data over
-Exporting to disk the contents of the table, truncate the table and reimporting the data both with Management Studio and the bcp tool.
-When copying to a new table I made also tried removing the PK of the table to skip the overhead of creating an index.
-I also tried using a simple spd to copy the data over (to the column in the same table and the other table) in batches.
In ALL my tests I set the SQLServer Recovery model to Simple to skip as much as I can the overhead of generating logs.
No matter what I do, the times to complete this operation seem to be unusable.
Please note that I am reducing this problem to its minimum expression. Can't say precisely how long the operation takes, but a script that contain 5 field type changes identical to that one in that and other two tables takes 7 days to complete!!! The REAL problem
is that I have several other fields to which I need to change the type, and they currently amount to a total running time of 14 days!. And this is just changing a handful of fields in a handful of tables. At some point every string in the system will need
to be migrated to get unicode support, making this completely impracticable.
**Based on smaller DBs in the same system I guesstimate this table will contain about 14M records and will be about 44Gb in size.
EXAMPLE 2: ADDING COLUMNS
I have another table int the same DB, with a schema detailed below as Table_2_TB, and again several million records in it. I am trying to add a colum using the following SQL:
ALTER TABLE DBA.Table2_TB ADD strFiDatasourceName_FD VARCHAR(64) NOT NULL DEFAULT ''
This operation takes a bit more than 7 hours to complete.
**Based on smaller DBs in the same system I guesstimate this table will contain about 54M records, and a size of 98Gb.
QUESTIONS:
---->Am I doing something wrong, or is there any way to optimize either the SQL or the SQLServer configuration to speed this up?
---->Are these performance levels normal at all when dealing with databases of this size?
---->Anyone out there with experience on DBs of this size?
---->Does Microsoft offer some kind of service (cloud?) to make structural changes in large Dbs?
Thanks a lot for your help in advance!
This is the schema for the first table:
CREATE TABLE [DBA].[Table_TB]( [BranchCode_FD] [char](2) NOT NULL, [FolderNo_FD] [int] NOT NULL, [DateTime_FD] [datetime] NULL, [Staff_FD] [char](3) NULL, [Action_FD] [varchar](25) NULL, [Comment_FD] [text] NULL, [Team_FD] [varchar](8) NULL, [Group_FD] [varchar](8) NULL, [PopUpDate_FD] [smalldatetime] NULL, [nRecordID_FD] [smallint] NOT NULL, [nFiFoldItemID_FD] [smallint] NOT NULL, PRIMARY KEY CLUSTERED ( [BranchCode_FD] ASC, [FolderNo_FD] ASC, [nRecordID_FD] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [DBA].[Table_TB] ADD CONSTRAINT [DF__Table_TB__DateTime] DEFAULT ('1980-01-01') FOR [DateTime_FD] GO ALTER TABLE [DBA].[Table_TB] ADD CONSTRAINT [DF__Table_TB__PopUp__096A45D7] DEFAULT ('1980-01-01') FOR [PopUpDate_FD] GO ALTER TABLE [DBA].[Table_TB] ADD DEFAULT ((-1)) FOR [nFiFoldItemID_FD] GO
This is the schema for the second table:
CREATE TABLE [DBA].[Table2_TB]( [strBBranchCode_FD] [char](2) NOT NULL, [lFFoldNo_FD] [int] NOT NULL, [nFiFoldItemID_FD] [smallint] NOT NULL, [strFiType_FD] [char](3) NOT NULL, [dtFiCreateDate_FD] [smalldatetime] NOT NULL, [strFiBookingRef_FD] [varchar](32) NOT NULL, [strFiBookingRefDayMonth_FD] [varchar](5) NOT NULL, [strFiBookedVia_FD] [varchar](50) NOT NULL, [bFiInterfaced_FD] [smallint] NOT NULL, [nFiSortOrder_FD] [smallint] NOT NULL, [strFiCreateStaffCode_FD] [char](3) NOT NULL, [strPcProductCode_FD] [varchar](5) NOT NULL, [dtFiStartDateTime_FD] [smalldatetime] NOT NULL, [lFiFinanVendID_FD] [int] NOT NULL, [lFiItinVendID_FD] [int] NOT NULL, [dtFiVendBalDueDate_FD] [smalldatetime] NOT NULL, [dtFiVendDepositDueDate_FD] [smalldatetime] NOT NULL, [strFiStatus_FD] [varchar](2) NOT NULL, [bFiTransFeeHasBeenApplied_FD] [smallint] NOT NULL, [bFiATOLTypeMan_FD] [smallint] NOT NULL, [nFiATOLType_FD] [smallint] NOT NULL, [strCcClassCode_FD] [varchar](10) NOT NULL, [strFiStartPointCode_FD] [varchar](5) NOT NULL, [strFiEndPointCode_FD] [varchar](5) NOT NULL, [strFiAirlineCode_FD] [varchar](3) NOT NULL, [strFiVendDocNo_FD] [varchar](16) NOT NULL, [dtFiIssueDate_FD] [smalldatetime] NOT NULL, [strFiDiscReasonCode_FD] [varchar](3) NOT NULL, [nFiLastFoldPricingID_FD] [smallint] NOT NULL, [strFiPrintingNote_FD] [text] NOT NULL, [strFiNonPrintingNote_FD] [text] NOT NULL, [dtFiStatusExpiryDate_FD] [smalldatetime] NOT NULL, [strFiClientFreqTravellerNo_FD] [varchar](20) NOT NULL, [strFiRouteNo_FD] [varchar](5) NOT NULL, [nFiNumBum_FD] [smallint] NOT NULL, [dtFiEndDateTime_FD] [smalldatetime] NOT NULL, [strFiFareBase_FD] [varchar](15) NOT NULL, [strFiInterfaceItemID_FD] [varchar](15) NOT NULL, [strFiEndPointLoc_FD] [varchar](255) NULL, [strFiStartPointLoc_FD] [varchar](255) NULL, [strMcMealCode_FD] [varchar](5) NOT NULL, [strFiSeatNote_FD] [text] NOT NULL, [strFiMealNote_FD] [text] NOT NULL, [strFiAirCraftType_FD] [varchar](5) NOT NULL, [strFiJourneyTime_FD] [varchar](8) NOT NULL, [strFiCheckInMins_FD] [varchar](10) NOT NULL, [lFiJourneyDist_FD] [int] NOT NULL, [nFiNumStop_FD] [smallint] NOT NULL, [strFiBaggageAllow_FD] [varchar](15) NOT NULL, [strFiIssueStaffCode_FD] [varchar](20) NOT NULL, [dtFiDispatchDate_FD] [smalldatetime] NOT NULL, [strFiDispatchStaffCode_FD] [varchar](3) NOT NULL, [strDmDispatchCode_FD] [varchar](2) NOT NULL, [lfFiVendDepositDueAmt_FD] [decimal](17, 2) NOT NULL, [strFiRateCode_FD] [varchar](50) NOT NULL, [strFiRatePlan_FD] [varchar](2) NOT NULL, [strFiCabinNo_FD] [varchar](8) NOT NULL, [strFiMileage_FD] [varchar](10) NOT NULL, [strFiStartPointLocTelNo_FD] [varchar](40) NULL, [strFiBookingGuarantee_FD] [varchar](60) NOT NULL, [strFiSpecialRemarks_FD] [varchar](250) NULL, [strFiCxnCondition_FD] [varchar](100) NOT NULL, [bFiFlyDrive_FD] [smallint] NOT NULL, [strFiConfNo_FD] [varchar](32) NOT NULL, [lFiLinkID_FD] [int] NOT NULL, [strFiCategory_FD] [varchar](15) NOT NULL, [nFiNumRoom_FD] [smallint] NOT NULL, [nFiNumDay_FD] [smallint] NOT NULL, [nFiSaleFoldItemID_FD] [smallint] NOT NULL, [bFiRefundItem_FD] [smallint] NOT NULL, [strFiFareSavingCode_FD] [varchar](2) NOT NULL, [lfFiFareSavingAmt_FD] [decimal](17, 2) NOT NULL, [strFiRateNote_FD] [text] NOT NULL, [strFiDiscCode_FD] [varchar](20) NOT NULL, [strFiReqDispatchMethodCode_FD] [varchar](2) NOT NULL, [dtFiReqDispatchDateTime_FD] [smalldatetime] NOT NULL, [nFiReqDispatchVoucherType_FD] [smallint] NOT NULL, [nFiLastFoldItemDetailID_FD] [smallint] NOT NULL, [nFiNumConjunction_FD] [smallint] NOT NULL, [lfFiBSPFrgnBaseFareAmt_FD] [decimal](17, 2) NOT NULL, [lfFiBSPBaseFareAmt_FD] [decimal](17, 2) NOT NULL, [lfFiBSPTaxDiscrepancy_FD] [decimal](17, 2) NOT NULL, [lfFiBSPPenaltyFeeAmt_FD] [decimal](17, 2) NOT NULL, [nFiRegion_FD] [smallint] NOT NULL, [strFiOpenTktNo_FD] [varchar](16) NOT NULL, [strFiTktSource_FD] [varchar](3) NOT NULL, [strFiJourneyType_FD] [varchar](3) NOT NULL, [strFiTktType_FD] [varchar](3) NOT NULL, [strFiInterfaceNameRemark_FD] [varchar](50) NULL, [nFiATOLIssuedStatus_FD] [smallint] NOT NULL, [strFiFareSavingFareBase_FD] [varchar](13) NOT NULL, [strFiPaxType_FD] [varchar](3) NOT NULL, [strFiActualCarrier_FD] [varchar](2) NOT NULL, [strFiNetRemitType_FD] [varchar](1) NOT NULL, [strFiFareConstruction_FD] [text] NOT NULL, [lfFiBSPTotVATAmt_FD] [decimal](17, 2) NOT NULL, [bFiNetFare_FD] [smallint] NOT NULL, [strFiTourCode_FD] [varchar](50) NOT NULL, [strFiSuppFOPInfo_FD] [varchar](255) NOT NULL, [lfFitBSPPublishedCommPerc_FD] [decimal](12, 6) NOT NULL, [strFiBSPFareCurrCode_FD] [varchar](3) NOT NULL, [strFiTktIssueIataNo_FD] [varchar](8) NOT NULL, [lfFiFareOfferedSavingAmt_FD] [decimal](17, 2) NOT NULL, [strFiFareOfferedSavingCode_FD] [varchar](2) NOT NULL, [strFiDesc_FD] [varchar](8000) NOT NULL, [lfFiBSPFareBuyDiscrepancyAmt_FD] [decimal](17, 2) NOT NULL, [bFiNoPrintOnItin_FD] [smallint] NOT NULL, [dtFiStatusCodeChangeDateTime_FD] [smalldatetime] NOT NULL, [bFiNoPrintIfAllPricingsZeroCustAmt_FD] [smallint] NOT NULL, [strFiFareSavingFareBaseLow_FD] [varchar](13) NOT NULL, [lfFiFareSavingLowAmt_FD] [decimal](17, 2) NOT NULL, [strFiBrochureCode_FD] [varchar](8) NOT NULL, [bFiVendPayDepositNow_FD] [smallint] NOT NULL, [bFiVendPayBalanceNow_FD] [smallint] NOT NULL, [strFiBankBranchCode_FD] [varchar](2) NOT NULL, [strFiOperatingAirlineCode_FD] [varchar](2) NOT NULL, [strFiFarePassengerTypeCode_FD] [varchar](3) NOT NULL, [strFiAssociatedFarePricingInfoID_FD] [varchar](15) NOT NULL, [bFiVerificationReq_FD] [smallint] NOT NULL, [dtFiLastVerifiedDateTime_FD] [datetime] NOT NULL, [lFiLastVerifiedLevel_FD] [int] NOT NULL, [lFiLastVerifiedWithCount_FD] [int] NOT NULL, [dtFiTktingStatusChangeDateTime_FD] [smalldatetime] NOT NULL, [strFiTktingInformation_FD] [text] NOT NULL, [strFiTktingStatus_FD] [varchar](2) NOT NULL, [lfFiBSPFareSellDiscrepancyAmt_FD] [decimal](17, 2) NOT NULL, [lfFiBSPTaxBuyDiscrepancyAmt_FD] [decimal](17, 2) NOT NULL, [strFiTktingBatchID_FD] [varchar](15) NOT NULL, [dtFiTktingBatchDateTime_FD] [smalldatetime] NOT NULL, [lIplPolicyLevelID_FD] [int] NOT NULL, [strFiTktingDescription_FD] [varchar](1000) NOT NULL, [strFiTktingDataVersion_FD] [varchar](10) NOT NULL, [strFiSourceTktingSystem_FD] [varchar](20) NOT NULL, [strFiOthPtsPmtCode_FD] [varchar](3) NOT NULL, [bFiManualPtsEntry_FD] [smallint] NOT NULL, [strFiEndorsement_FD] [varchar](500) NOT NULL, [strFiOwnedByStaffCode_FD] [char](3) NOT NULL, [strFiThirdPartyTrackingID_FD] [varchar](25) NOT NULL, [strFiAdditionalPrintingNote_FD] [text] NULL, [bFiOverridePrintingNote_FD] [smallint] NOT NULL, [lfFiCarbonOffsetWeightAmt_FD] [decimal](17, 2) NOT NULL, [strFiCancellationPolicyNote_FD] [text] NULL, [bFiPEProcessed_FD] [smallint] NOT NULL, [bFiActingAsAgentFor_FD] [smallint] NOT NULL, [nFiOriginalBuyingBasis_FD] [smallint] NOT NULL, [bFiIsOpenSegment_FD] [smallint] NOT NULL, [nFiCreateSource_FD] [smallint] NOT NULL, [strFiBookingSourceInvoiceNo_FD] [varchar](7) NOT NULL, [strFiGDSPaxTypeCode_FD] [varchar](8) NOT NULL, [strFiNetFareGDSAccountCode_FD] [varchar](8) NOT NULL, [strFiPOSID_FD] [varchar](50) NOT NULL, [bFiIsPOSEditable_FD] [smallint] NOT NULL, [lfFiCustExchRate_FD] [decimal](16, 8) NOT NULL, [lfFiCustFareSavingLowAmt_FD] [decimal](17, 2) NOT NULL, [lfFiCustFareSavingAmt_FD] [decimal](17, 2) NOT NULL, [lfFiCustFareOfferedSavingAmt_FD] [decimal](17, 2) NOT NULL, [bFiCCItemPayableToBranch_FD] [smallint] NOT NULL, [dtFiExternalAccountingDate_FD] [smalldatetime] NOT NULL, [strFiSourceSystemBookResponseText_FD] [text] NOT NULL, [bFiIsConnection_FD] [smallint] NOT NULL, [bFiIsPEFoldLevelItem_FD] [smallint] NOT NULL, [nFiReqdEndorsedConjTktType_FD] [smallint] NOT NULL, [bFiEndorsedConjTktDetailIsManual_FD] [smallint] NOT NULL, [strFiReqdEndorsedConjTktDetailText_FD] [varchar](30) NOT NULL, [lFiLastTktingTemplateID_FD] [int] NOT NULL, [dtFiBookedDate_FD] [smalldatetime] NOT NULL, [strFiTktingVerificationWarning_FD] [varchar](1000) NOT NULL, [strFiTktingVerificationError_FD] [varchar](1000) NOT NULL, [strFiTktingError_FD] [varchar](1000) NOT NULL, [strFiCustomerAccountingData00_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData01_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData02_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData03_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData04_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData05_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData06_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData07_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData08_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData09_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingDataNote_FD] [varchar](100) NOT NULL, [strFiCustomerAccountingData10_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData11_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData12_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData13_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData14_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData15_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData16_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData17_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData18_FD] [varchar](50) NOT NULL, [strFiCustomerAccountingData19_FD] [varchar](50) NOT NULL, [nFiFlightBasis_FD] [smallint] NOT NULL, [lFiStartPointVendID_FD] [int] NOT NULL, [lFiEndPointVendID_FD] [int] NOT NULL, [lCtID_FD] [int] NOT NULL, [strFiContractCode_FD] [varchar](25) NOT NULL, [strFiContractPeriodCode_FD] [varchar](50) NOT NULL, PRIMARY KEY CLUSTERED ( [strBBranchCode_FD] ASC, [lFFoldNo_FD] ASC, [nFiFoldItemID_FD] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [DBA].[Table2_TB] WITH NOCHECK ADD FOREIGN KEY([nFiReqDispatchVoucherType_FD]) REFERENCES [DBA].[VoucherTypes_TB] ([nVtCode_FD]) GO ALTER TABLE [DBA].[Table2_TB] WITH NOCHECK ADD FOREIGN KEY([strPcProductCode_FD], [strFiType_FD]) REFERENCES [DBA].[ProductCodes_TB] ([ProductCode_FD], [Type_FD]) GO ALTER TABLE [DBA].[Table2_TB] WITH NOCHECK ADD FOREIGN KEY([strBBranchCode_FD], [lFFoldNo_FD]) REFERENCES [DBA].[Folder_TB] ([BranchCode_FD], [FolderNo_FD]) GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strBB__44AB0736] DEFAULT ('') FOR [strBBranchCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lFFol__459F2B6F] DEFAULT (0) FOR [lFFoldNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiFo__46934FA8] DEFAULT ((-1)) FOR [nFiFoldItemID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__478773E1] DEFAULT ('') FOR [strFiType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiC__487B981A] DEFAULT ('1980-01-01') FOR [dtFiCreateDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__strFiBookingRef] DEFAULT ('') FOR [strFiBookingRef_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__4A63E08C] DEFAULT ('') FOR [strFiBookingRefDayMonth_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__strFiBookedVia_FD] DEFAULT ('') FOR [strFiBookedVia_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiIn__4C4C28FE] DEFAULT (0) FOR [bFiInterfaced_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiSo__4D404D37] DEFAULT ((-1)) FOR [nFiSortOrder_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__4E347170] DEFAULT ('') FOR [strFiCreateStaffCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__strPcProductCode] DEFAULT ('') FOR [strPcProductCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiS__501CB9E2] DEFAULT ('1980-01-01') FOR [dtFiStartDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lFiFi__5110DE1B] DEFAULT ((-1)) FOR [lFiFinanVendID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lFiIt__52050254] DEFAULT ((-1)) FOR [lFiItinVendID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiV__52F9268D] DEFAULT ('1980-01-01') FOR [dtFiVendBalDueDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiV__53ED4AC6] DEFAULT ('1980-01-01') FOR [dtFiVendDepositDueDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__54E16EFF] DEFAULT ('') FOR [strFiStatus_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiTr__55D59338] DEFAULT (0) FOR [bFiTransFeeHasBeenApplied_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiAT__56C9B771] DEFAULT (0) FOR [bFiATOLTypeMan_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiAT__57BDDBAA] DEFAULT (0) FOR [nFiATOLType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strCc__58B1FFE3] DEFAULT ('') FOR [strCcClassCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__strFiStartPointCode] DEFAULT ('') FOR [strFiStartPointCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__strFiEndPointCode] DEFAULT ('') FOR [strFiEndPointCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__5B8E6C8E] DEFAULT ('') FOR [strFiAirlineCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__5C8290C7] DEFAULT ('') FOR [strFiVendDocNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiI__5D76B500] DEFAULT ('1980-01-01') FOR [dtFiIssueDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__5E6AD939] DEFAULT ('') FOR [strFiDiscReasonCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiLa__5F5EFD72] DEFAULT ((-1)) FOR [nFiLastFoldPricingID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__605321AB] DEFAULT ('') FOR [strFiPrintingNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__614745E4] DEFAULT ('') FOR [strFiNonPrintingNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiS__623B6A1D] DEFAULT ('1980-01-01') FOR [dtFiStatusExpiryDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__632F8E56] DEFAULT ('') FOR [strFiClientFreqTravellerNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6423B28F] DEFAULT ('') FOR [strFiRouteNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_TB__nFiNumBum] DEFAULT ((-1)) FOR [nFiNumBum_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiE__660BFB01] DEFAULT ('1980-01-01') FOR [dtFiEndDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__67001F3A] DEFAULT ('') FOR [strFiFareBase_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__67F44373] DEFAULT ('') FOR [strFiInterfaceItemID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__68E867AC] DEFAULT ('') FOR [strFiEndPointLoc_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__69DC8BE5] DEFAULT ('') FOR [strFiStartPointLoc_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strMc__6AD0B01E] DEFAULT ('') FOR [strMcMealCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6BC4D457] DEFAULT ('') FOR [strFiSeatNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6CB8F890] DEFAULT ('') FOR [strFiMealNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6DAD1CC9] DEFAULT ('') FOR [strFiAirCraftType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6EA14102] DEFAULT ('') FOR [strFiJourneyTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__6F95653B] DEFAULT ('') FOR [strFiCheckInMins_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lFiJo__70898974] DEFAULT (0) FOR [lFiJourneyDist_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiNu__717DADAD] DEFAULT (0) FOR [nFiNumStop_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7271D1E6] DEFAULT ('') FOR [strFiBaggageAllow_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7365F61F] DEFAULT ('') FOR [strFiIssueStaffCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiD__745A1A58] DEFAULT ('1980-01-01') FOR [dtFiDispatchDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__754E3E91] DEFAULT ('') FOR [strFiDispatchStaffCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strDm__764262CA] DEFAULT ('') FOR [strDmDispatchCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiV__77368703] DEFAULT (0) FOR [lfFiVendDepositDueAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__782AAB3C] DEFAULT ('') FOR [strFiRateCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__791ECF75] DEFAULT ('') FOR [strFiRatePlan_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7A12F3AE] DEFAULT ('') FOR [strFiCabinNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7B0717E7] DEFAULT ('') FOR [strFiMileage_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7BFB3C20] DEFAULT ('') FOR [strFiStartPointLocTelNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7CEF6059] DEFAULT ('') FOR [strFiBookingGuarantee_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7DE38492] DEFAULT ('') FOR [strFiSpecialRemarks_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__7ED7A8CB] DEFAULT ('') FOR [strFiCxnCondition_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiFl__7FCBCD04] DEFAULT (0) FOR [bFiFlyDrive_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__00BFF13D] DEFAULT ('') FOR [strFiConfNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lFiLi__01B41576] DEFAULT ((-1)) FOR [lFiLinkID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__02A839AF] DEFAULT ('') FOR [strFiCategory_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiNu__039C5DE8] DEFAULT (0) FOR [nFiNumRoom_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiNu__04908221] DEFAULT (0) FOR [nFiNumDay_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiSa__0584A65A] DEFAULT ((-1)) FOR [nFiSaleFoldItemID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiRe__0678CA93] DEFAULT (0) FOR [bFiRefundItem_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__076CEECC] DEFAULT ('') FOR [strFiFareSavingCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiF__08611305] DEFAULT (0) FOR [lfFiFareSavingAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__0955373E] DEFAULT ('') FOR [strFiRateNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__0A495B77] DEFAULT ('') FOR [strFiDiscCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__0B3D7FB0] DEFAULT ('') FOR [strFiReqDispatchMethodCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__dtFiR__0C31A3E9] DEFAULT ('1980-01-01') FOR [dtFiReqDispatchDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiRe__0D25C822] DEFAULT (0) FOR [nFiReqDispatchVoucherType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiLa__0F0E1094] DEFAULT ((-1)) FOR [nFiLastFoldItemDetailID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiNu__100234CD] DEFAULT (0) FOR [nFiNumConjunction_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiB__10F65906] DEFAULT (0) FOR [lfFiBSPFrgnBaseFareAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiB__11EA7D3F] DEFAULT (0) FOR [lfFiBSPBaseFareAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiB__12DEA178] DEFAULT (0) FOR [lfFiBSPTaxDiscrepancy_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiB__13D2C5B1] DEFAULT (0) FOR [lfFiBSPPenaltyFeeAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiDo__14C6E9EA] DEFAULT (0) FOR [nFiRegion_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__15BB0E23] DEFAULT ('') FOR [strFiOpenTktNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__16AF325C] DEFAULT ('') FOR [strFiTktSource_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__17A35695] DEFAULT ('') FOR [strFiJourneyType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__18977ACE] DEFAULT ('') FOR [strFiTktType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__198B9F07] DEFAULT ('') FOR [strFiInterfaceNameRemark_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__nFiAT__1A7FC340] DEFAULT ((-1)) FOR [nFiATOLIssuedStatus_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__1B73E779] DEFAULT ('') FOR [strFiFareSavingFareBase_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__1C680BB2] DEFAULT ('') FOR [strFiPaxType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__1D5C2FEB] DEFAULT ('') FOR [strFiActualCarrier_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__1E505424] DEFAULT ('') FOR [strFiNetRemitType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__1F44785D] DEFAULT ('') FOR [strFiFareConstruction_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiB__20389C96] DEFAULT (0) FOR [lfFiBSPTotVATAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__bFiNe__212CC0CF] DEFAULT (0) FOR [bFiNetFare_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__2220E508] DEFAULT ('') FOR [strFiTourCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__23150941] DEFAULT ('') FOR [strFiSuppFOPInfo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFit__24092D7A] DEFAULT (0) FOR [lfFitBSPPublishedCommPerc_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__24FD51B3] DEFAULT ('') FOR [strFiBSPFareCurrCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__25F175EC] DEFAULT ('') FOR [strFiTktIssueIataNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__lfFiF__27D9BE5E] DEFAULT (0) FOR [lfFiFareOfferedSavingAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD CONSTRAINT [DF__Table2_T__strFi__251D4D44] DEFAULT ('') FOR [strFiFareOfferedSavingCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiDesc_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lfFiBSPFareBuyDiscrepancyAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiNoPrintOnItin_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-1-1') FOR [dtFiStatusCodeChangeDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiNoPrintIfAllPricingsZeroCustAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiFareSavingFareBaseLow_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lfFiFareSavingLowAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiBrochureCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiVendPayDepositNow_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiVendPayBalanceNow_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiBankBranchCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiOperatingAirlineCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiFarePassengerTypeCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiAssociatedFarePricingInfoID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiVerificationReq_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-01-01') FOR [dtFiLastVerifiedDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lFiLastVerifiedLevel_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lFiLastVerifiedWithCount_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-01-01') FOR [dtFiTktingStatusChangeDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingInformation_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingStatus_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lfFiBSPFareSellDiscrepancyAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lfFiBSPTaxBuyDiscrepancyAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingBatchID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-01-01') FOR [dtFiTktingBatchDateTime_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((-1)) FOR [lIplPolicyLevelID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingDescription_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingDataVersion_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiSourceTktingSystem_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiOthPtsPmtCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiManualPtsEntry_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiEndorsement_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiOwnedByStaffCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiThirdPartyTrackingID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiAdditionalPrintingNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiOverridePrintingNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [lfFiCarbonOffsetWeightAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCancellationPolicyNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiPEProcessed_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiActingAsAgentFor_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [nFiOriginalBuyingBasis_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiIsOpenSegment_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [nFiCreateSource_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (' ') FOR [strFiBookingSourceInvoiceNo_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiGDSPaxTypeCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiNetFareGDSAccountCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiPOSID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT (0) FOR [bFiIsPOSEditable_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [lfFiCustExchRate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [lfFiCustFareSavingLowAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [lfFiCustFareSavingAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [lfFiCustFareOfferedSavingAmt_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [bFiCCItemPayableToBranch_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-01-01') FOR [dtFiExternalAccountingDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiSourceSystemBookResponseText_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [bFiIsConnection_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [bFiIsPEFoldLevelItem_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [nFiReqdEndorsedConjTktType_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [bFiEndorsedConjTktDetailIsManual_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiReqdEndorsedConjTktDetailText_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((-1)) FOR [lFiLastTktingTemplateID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('1980-01-01') FOR [dtFiBookedDate_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingVerificationWarning_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingVerificationError_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiTktingError_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData00_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData01_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData02_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData03_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData04_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData05_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData06_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData07_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData08_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData09_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingDataNote_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData10_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData11_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData12_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData13_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData14_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData15_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData16_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData17_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData18_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiCustomerAccountingData19_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((0)) FOR [nFiFlightBasis_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((-1)) FOR [lFiStartPointVendID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((-1)) FOR [lFiEndPointVendID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ((-1)) FOR [lCtID_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiContractCode_FD] GO ALTER TABLE [DBA].[Table2_TB] ADD DEFAULT ('') FOR [strFiContractPeriodCode_FD] GO
Question regarding snapshot isolation
We have SQL Server 2008 R2. We have implemented a logon trigger on this server so that only particular user/application combinations are allowed into the server, and all others are logged. This works perfectly fine.
Recently we have had a vendor trying to install an application that uses WCF. Their database has read_committed_snapshot on and allow_snapshot_isolation on. This is the only database on my server with these options. When their software tries to run, I get the
following error message in my SQL log:
"Snapshot isolation transaction failed accessing database 'LogonLog' because snapshot isolation is not allowed in this database. Use ALTER DATABASE to allow snapshot isolation."
I'm not sure why their code is causing my logon trigger to fail, but I am guessing that they use transactions and the trigger is getting thrown into the snapshot isolation. I am wondering if I set these two options on my trigger database if I could be causing any performance issues, or cause other applications to fail? I really don't want to change this trigger DB for one application, especially if it could cause me bigger issues, but I am looking to see if anyone has any thoughts on it. Thanks.
Email Notification after the backup job is complete
I have the email working and it sends email after the differential and full backup is complete but I have added the logfile backup but it does not append to the same email. I did not write all the steps when I configured 1st time and I am screwed now. I have the database mail setup. Is that enough to send email after the job is complete. I want to email to read the path of the backup. I have done restart of the sql aAgent too but no luck. I have followed instruction on the following
http://www.kodyaz.com/articles/sql2005-database-mail.aspx
http://www.howtogeek.com/howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/
http://www.databasejournal.com/features/mssql/article.php/3626056/Database-Mail-in-SQL-Server-2005.htm
Tempdb space issue
Hi,
We are facing space issue with tempdb. In tempdb .mdf file, space is showing 99% free but not able to release space using shrinking also used below queries to release space.
Query:
DBCC FREEPROCCACHE
GO
DBCC DROPCLEANBUFFERS
go
DBCC FREESYSTEMCACHE ('ALL')
GO
DBCC FREESESSIONCACHE
GO
DBCC SHRINKFILE (2,1024)
GO
I ran below query and observed that one session was there in tempdb and its status was showing "SUSPENDED".
Query:
select * from sys.sysprocesses where dbid = 2
Users are getting below error while using tempdb.
Error:
begin try drop table xxxxxxxxx..." failed with the following error: "Could not allocate space for object '' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup,
adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection
not established correctly.
I have below questions.
1) Why we were not able to release space from tempdb ?
2) In tempdb .mdf file, 99% free space was showing but why users was getting space issue.
3)Issue repeating regularly, any permanent solution for this.
Server details are mentioned below.
SQL Version : 2008R2 (10.50.4000.0)
Service Pack 2
Edition: Enterprise Edition (64-bit)
OS: Windows server 2008R2 Enterrice Edition
Can any one please help.
Thanks in advance.
Space problem not identified?
Hello,
I am getting every other day and error in SQL:
Same problem again during the week-end the MSSQL$NESTOR Instance errored out between: 7:36 am and 7:54 am on 1/17/2015 it was restored by the shrinktmp SQL job by 8:00 am and works again… 7:31 am and 7:50 am on 1/19/2015 it was restored by the shrinktmp SQL job by 8:00 am and works again… K:\MSSQL10.NESTOR\MSSQL\DATA\templog.ldf: Operating system error 112(There is not enough space on the disk.) encountered. The transaction log for database 'tempdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
I don not have any SQL job running by this time.
I could not find any message in the event logs (Application, System) except the space issue by 7:40 am...
What could happen? How to trace this issue? What is using the templog.ldf ?
Thanks,
Dom
System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager
SQL upgrade from SQL 2008R2 to SQL 2012
I have upgraded SQL server from SQL Server 2008R2 to SQL Server 2012 SP1 on Test server using in-place upgrade Method.Now I would like to test my Roll back an in-plan upgrade plan on Test server .
1] install SQL server 2008R2 instance on server
2]restore System Databases from the valid Backups that I took before I start the upgrade
3]Restore user Database from the Backup
Could someone please advise me that are those valid steps in order to roll back SQL server 2012 in-place upgrade ? is there something I missed ?
Could someone also answer to my the following Questions ?
What kind of Testing should I need to do to making sure there is no need to Roll back SQL 2012 upgrade ?
What steps should I need to take before I start to upgrading SQL server 2008R2 instance to SQL 2012SP1 ?Those steps will help me in case if I need to Roll back an in-place upgrade ?
Are there any SQL tool or methode should I use like SQL import /Export or something else ? I tested SQL import and export to copy Data from SQL20012 to SQL 2008R2 and it did not work and got error message
Length or precision specification 0 is invalid.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
After SQL 2012 upgrade , Is Users accidently started to using Application and did some transactions in SQL 2012 and we need to roll back in in-place upgrade then How should I transafer /recove those modified Data from SQL 2012 to SQL 2008 R2 ?
Your Help will be apprecieted.
Thanks
Daizy
No Context for module while using WinDbg
I would like to request some help with an issue reading a few SQL Server dumps. I'm currently analyzing a dump created by SQL Server 2012 Enterprise. The dump is due to a “Non-Yielding Scheduler” issue that has occurred at least 6 times with in the last two weeks.
My issue is, I am unable to load the following symbol modules, while using WinDbg.
************* Symbol Loading Error Summary **************
Module name Error
sqlevn70 No data is available : srv*c:\websymbols*http://msdl.microsoft.com/download/symbols
SQLNCLIR11 No data is available : srv*c:\websymbols*http://msdl.microsoft.com/download/symbols
msfte The system cannot find the file specified : srv*c:\websymbols*http://msdl.microsoft.com/download/symbols
XPStar No data is available : srv*c:\websymbols*http://msdl.microsoft.com/download/symbols
xplog70 No data is available : srv*c:\websymbols*http://msdl.microsoft.com/download/symbols
Is this a known issue, has anyone seen this issue, and if so is there a workaround to the issue?
Thanks you for your help in advance.
Curtis
Auditing OPEN SYMMETRIC KEY by dbo user
I am trying to find a way to audit when a database owner opens a symmetric key. According to Books Online, adding DATABASE_OBJECT_ACCESS_GROUP to a database audit spec should cover this event. I tried testing this by creating a new database and running the below transact sql. I was surprised to see the audit log was empty. Am I approaching this correctly or is there no way to audit this event?
/* AUDITING */
USE master
GO
CREATE SERVER AUDIT PCIAuditLog
TO FILE (FILEPATH = 'C:\Temp', MAXSIZE = 1024MB )
WITH (ON_FAILURE = continue)
ALTER SERVER AUDIT [PCIAuditLog] WITH (STATE = ON)
USE Test
GO
CREATE DATABASE AUDIT SPECIFICATION [TestAuditSpec] FOR SERVER AUDIT [PCIAuditLog] ADD (DATABASE_OBJECT_ACCESS_GROUP) WITH (STATE = ON)
GO
CREATE CERTIFICATE PasswordsCert WITH SUBJECT = 'Passwords Cert'
CREATE SYMMETRIC KEY PasswordsKey
WITH ALGORITHM = AES_256
ENCRYPTION BY CERTIFICATE PasswordsCert
GO
-- Create a column in which to store the encrypted data.
CREATE TABLE AlertRoute (
AlertRouteId INT,
AlertRouteDescr NVARCHAR(50),
UserName NVARCHAR(100),
Password VARBINARY(128)
)
GO
-- Insert Encrypted Row
OPEN SYMMETRIC KEY PasswordsKey DECRYPTION BY CERTIFICATE PasswordsCert
INSERT INTO AlertRoute VALUES (1, 'Encryption Test', 'billp', ENCRYPTBYKEY(KEY_GUID('PasswordsKey'), 'PasswordClearText'))
CLOSE SYMMETRIC KEY PasswordsKey
GO
SELECT * FROM AlertRoute
GO
OPEN SYMMETRIC KEY PasswordsKey DECRYPTION BY CERTIFICATE PasswordsCert
SELECT *, CONVERT(VARCHAR(MAX), DECRYPTBYKEY(Password)) DecryptedPassword FROM AlertRoute
CLOSE SYMMETRIC KEY PasswordsKey
GO
-- View Audit file
SELECT
AuditFile.*
FROM
sys.dm_server_audit_status AS AuditStatus
CROSS APPLY sys.fn_get_audit_file ('C:\Temp\PCIAuditLog_67FCC904-4F9B-4D21-AEB6-BB6DB6CE4E86_0_130662204682920000.sqlaudit', default, default) AS AuditFile
SQL Server 2014 fails to start. missing mssqlsystemresource.ldf?
Hi
I restart the server and SQL server doesn't start.
I have got this error message from the log file.
FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Binn\mssqlsystemresource.ldf'. Diagnose and correct the operating system error, and retry the operation.
I browsed the folder and could not find the fjile, mssqlsystemresource.ldf.
Can anyone point to a direction please?
Thanks
Kind regards
Mark
Statistics MultiColumn created Automatically With PrimaryKey
Hi Folks,
In my SQL server statistics are created with Multi column automatically.
All column is created with Primary key column.
I don't know why it's created.I read some experts blog they told SQL statistics wont create a multiple column automatically.
May i know the reason why it is create like that and may it will degrade the performance or it's good for SQL Server.
Here i Attached the table statistics detail
I Highlighted the columns are created automatically.
ActivityID --> Primary Key of the Table.
It will created automatically with other columns.
Please help me!!!
Thanks For the Advance,
BY
RamKarthik K N
SQL Server 2008 R2 Core and performance
In a VM environment, can we increase the number of cores for the OS, while restricting the cores for SQL. We want to dedicate the licensed SQL cores solely to SQL, and use excess cores to run the OS. This is an attempt to maximize performance on the SQL server.
Is it possible, Is it legal, Will it improve performance?.
[Forum FAQ] How do I restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity
Question
Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
Answer
When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs.
In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
- Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
-- Create database CDCTest
CREATE DATABASE [CDCTest] ON PRIMARY
( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
use CDCTest;
go
-- creating table
create table Customer
(
custID int constraint PK_Employee primary key Identity(1,1)
,custName varchar(20)
)
--Enabling CDC on CDCTest database
USE CDCTest
GO
EXEC sys.sp_cdc_enable_db
--Enabling CDC on Customer table
USE CDCTest
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'dbo',
@source_name = N'Customer',
@role_name = NULL
GO
--Inserting values in customer table
insert into Customer values('Mike'),('Linda')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking full database backup
backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
insert into Customer values('David'),('Jane')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
--Taking differential database backup
BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
GO - Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
Use master
Go
--restore full database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc - Restore Diff backup of the ‘CDCTest’ database.
Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
Replace,
NoRecovery;
Go
--restore differential database backup
restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc - Add the Capture and Cleanup jobs in the CDCTest database.
--add the Capture and Cleanup jobs
Use CDCTest
exec sys.sp_cdc_add_job 'capture'
GO
exec sys.sp_cdc_add_job 'cleanup'
GO
insert into Customer values('TEST'),('TEST1')
-- Querying CDC table to get the changes
select * from cdc.dbo_customer_CT
Reference
Track Data Changes (SQL Server)
Restoring a SQL Server database that uses Change Data Capture
Applies to
SQL Server 2014
SQL Server 2012
SQL Server 2008 R2
SQL Server 2008
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.
The transaction log is full
Hi guys, I made a backup, I shrinked the log file but I still have this error when I try to delete a huge table
The transaction log for database 'Reporting' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
My set for the log is Autogrowt 10% until 6000mb. My backup state is simple recovery..
Any advice?
Thanks
SQL Profiler Trace ran overnight and blowed up the production db server..need urgent help!!
Hi ,
I ran the SQL profiler trace on production server overnight with some selected events to save the trace files on D:\ and now the production server is down this morning. I cant RDP into the server. I am on call with support guys to bring the server up but do you think creating sql trace files would have consumed all windows memory and shut down the server? if thats the case once server is up , how can I confirm that and how can I turn SQL server back ?
Would really appreciate some suggestions pls.
Thanks
Sim
Alert for orphaned files (.mdf, .ldf & .ndf)
Hi,
Has anyone got any code that can scan all attached drives/directories for database files and compare them to what the instance says are attached files? I have some code which works but you have specify the directories to monitor.
I know that I could do this in C# quite easily but I'm wondering if it could all be done in T-SQL. Also could I run into permissions issues if the process is scanning all directories.
This is the SQL code I have
CREATE PROCEDURE [dbo].[UspReport_OrphanedDatabaseFile](
@FileLocation VARCHAR(512)
)
AS
BEGIN
SET NOCOUNT ON;
-- create temporary table to capture file names from directory.
if object_id('tempdb..#folderandfileinfo') is not null
BEGIN
DROP TABLE #folderandfileinfo;
END;
create table #folderandfileinfo
(
cid int identity(1,1) primary key clustered,
subdirectory varchar(255),
depth int,
isfile int
);
exec master..xp_dirtree @FileLocation, 1, 1;
select
@FileLocation AS [Path Location] ,
subdirectory AS [Orphaned Data Files]
from
#folderandfileinfo
where
subdirectory like '%df' -- compares ONLY to .mdf, .ndf, and .ldf
and subdirectory not in
(
select right(smf.physical_name, charindex('\', reverse('\' + smf.physical_name)) - 1)
from
sys.master_files smf join sys.databases sd on smf.database_id = sd.database_id
)
order by
subdirectory asc;
END
Moving SQL Server Logins
HI ,
We are planning to upgrade our SQL Server 2008 R2 sp2 to SQL Server 2012 SP1. It is an out of place upgrade. I have already tried the below KB article. But when I am exec sp_help_revlogin it is throwing errors. Can anyone let us know how to transfer SQL Server logins from old server to new server.
KR article:
http://support.microsoft.com/kb/246133
Regards,
Varun
User defined table types sometimes show up a unknown data type in Profiler
A couple of our users have a problem when using user defined table types. Calls are made using UDTT as variables and these are then passed to a stored procedure as parameters. Sometimes the application returns a timeout. In such situations a Profiler-Trace shows the following:
declare @p4 unknown
whereas the correct trace (that is sometimes displayed) should be:
declare @p4 dbo.ReportFilterTableType
ReportFilterTableType is a UDTT. The users do have correct permissions for the UDTT (otherwise they would never be usable for the user). What could be the reason that the data types for the variable@p4 in the example are sometimes returned as unknown and at other times are returned correctly asReportFilterTableType? Could this possibly be a network related issue?
Thank you.
Graham Goodwin Email: g.goodwin@inova.ch
Unable to download SQL 2014.
Hi
I am an authorized user of MSDN and I have been trying to download MS SQL 2014 for the last week. However the download is ridiculously slow and it is not because of my data line because I have tried to download from a leased line and using an ADSL line.
The problem is that it downloads for about 40 - 50% and then disconnects. The 40 - 50% takes more than 5 - 6 hours. I don't have this problem on any other site. We are VLSC with MSDN license and this is seriously frustrating.
Please HELP
If this is not the right forum please give me details of the correct forum
Regards
Matthew