Unable to change any data for single record in table. I keep getting a write conflict message. All other data in table can be changed - ms-access

As stated above, I am unable to change any data in a single record of a table. No other users are in the table or database. I do not have other copies of the database open. I keep getting a write conflict error, with only the "copy to clipboard" and "drop changes" options available to select. Is there any other explanation for why I'd be getting a write conflict error for one record in this table? Could there be something in the VBA that is locking this record? I am able to edit other records in the table, but this single record seems to be locked.
EDIT: as requested by #Andre, here is the full CREATE TABLE statement
CREATE TABLE [dbo].[2450Other_t1](
[ID] [int] NOT NULL,
[UPN] [int] NULL,
[CRID] [int] NULL,
[bmt_date] [datetime] NULL,
[Visit] [nvarchar](5) NULL,
[ContributingCOD] [nvarchar](40) NULL,
[NewMalignancyEBV] [nvarchar](5) NULL,
[DiseaseStatusNorCR] [nvarchar](25) NULL,
[SUBSEQ_T] [nvarchar](5) NULL,
[Ind_Subseq] [nvarchar](25) NULL,
[Source_Subseq] [nvarchar](255) NULL,
[CellTherapy] [nvarchar](25) NULL,
[Date_CT] [datetime] NULL,
[GraftFail] [nvarchar](5) NULL,
[AGVHDDevelop] [nvarchar](5) NULL,
[date agvhd] [datetime] NULL,
[date agvhd prior] [nvarchar](5) NULL,
[grade at diag] [nvarchar](10) NULL,
[skin] [int] NULL,
[gut] [int] NULL,
[ugi] [int] NULL,
[liver] [int] NULL,
[other_sites] [nvarchar](25) NULL,
[date max agvhd] [datetime] NULL,
[cghvd develop] [nvarchar](5) NULL,
[cgvhd persist] [nvarchar](5) NULL,
[max cgvhd] [nvarchar](10) NULL,
[date max cgvhd] [datetime] NULL,
[on steroids] [nvarchar](5) NULL,
[other ist] [nvarchar](5) NULL,
[Liver Therapy] [nvarchar](5) NULL,
[liver agents] [nvarchar](25) NULL,
[VodDevelop] [nvarchar](5) NULL,
[vod date] [datetime] NULL,
[chimerism] [nvarchar](5) NULL,
[best-no cr] [nvarchar](255) NULL,
[best pcr] [nvarchar](5) NULL,
[best pcr detect] [nvarchar](5) NULL,
[best pcr date] [datetime] NULL,
[best flow] [nvarchar](5) NULL,
[best flow detect] [nvarchar](5) NULL,
[best flow date] [datetime] NULL,
[best cyto] [nvarchar](5) NULL,
[best fish] [nvarchar](5) NULL,
[best fish detect] [nvarchar](5) NULL,
[best fish date] [datetime] NULL,
[best karyo] [nvarchar](5) NULL,
[best karyo detect] [nvarchar](5) NULL,
[best karyo date] [datetime] NULL,
[best rad] [nvarchar](5) NULL,
[best rad detect] [nvarchar](5) NULL,
[best rad date] [datetime] NULL,
[best clin] [nvarchar](5) NULL,
[best clin detect] [nvarchar](5) NULL,
[best clin date] [datetime] NULL,
[post-syst] [nvarchar](5) NULL,
[post drug1] [nvarchar](50) NULL,
[post drug2] [nvarchar](50) NULL,
[post drug3] [nvarchar](50) NULL,
[post drug4] [nvarchar](50) NULL,
[rlp prior] [nvarchar](5) NULL,
[rlp intv] [nvarchar](5) NULL,
[rlp reason intv] [nvarchar](50) NULL,
[rlp clin] [nvarchar](5) NULL,
[rlp rad] [nvarchar](5) NULL,
[rlp cyto] [nvarchar](5) NULL,
[rlp flow] [nvarchar](5) NULL,
[rlp pcr] [nvarchar](5) NULL,
[rlp chim] [nvarchar](5) NULL,
[rlp date intervent] [datetime] NULL,
[rlp drug1] [nvarchar](50) NULL,
[rlp drug2] [nvarchar](50) NULL,
[rlp drug3] [nvarchar](50) NULL,
[rlp drug4] [nvarchar](50) NULL,
[current not cr] [nvarchar](20) NULL,
[rlp drug5] [nvarchar](50) NULL,
[rlp drug6] [nvarchar](50) NULL,
[rlp drug7] [nvarchar](50) NULL,
[rlp drug8] [nvarchar](50) NULL,
[MaxSkin] [int] NULL,
[MaxGut] [int] NULL,
[MaxUgi] [int] NULL,
[MaxLiver] [int] NULL,
[MaxOther] [nvarchar](25) NULL,
[ScndMalig] [nvarchar](3) NULL,
[scndMaligDate] [datetime] NULL,
[2cndDoc] [nvarchar](3) NULL,
[2NDMALIGDONOR] [nvarchar](7) NULL,
CONSTRAINT [2450Other_t1$PrimaryKey] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

Related

Convert MSSQL to mysql table

Can I know the easiest way to convert the Microsoft sql query to MYSQL.
sample query of Microsoft sql query:
CREATE TABLE [dbo].[T_NEWBIZ](
[newbID] [int] IDENTITY(1,1) NOT NULL,
[planID] [int] NULL,
[applID] [int] NULL,
[taxqID] [int] NULL,
[doptID] [int] NULL,
[stcoID] [int] NULL,
[crsnID] [int] NULL,
[newbEPBR] [bit] NULL,
[newbPolicyNo] [varchar](50) NULL,
[newbEffectiveDate] [varchar](20) NULL,
[newbIssueDate] [varchar](20) NULL,
[newbDistributorOrderNumber] [varchar](30) NULL,
[newbJointAnnuitantNA] [bit] NULL,
[newbOwnerIsAnnuitant] [bit] NULL,
[newbDeliveryEMail] [varchar](100) NULL,
[newbDeliveryConsent] [bit] NULL,
[newbAnnuityOptionSpecialRequest] [varchar](500) NULL,
[newbCSRID] [varchar](20) NULL,
[newbBrokerID] [varchar](10) NULL,
[newbUGMA] [bit] NULL,
[newbUTMA] [bit] NULL,
[newbRecapAvailable] [bit] NULL,
[newbOriginatorCode] [varchar](8) NULL,
[newbFileNetStatus] [char](1) NULL,
[newbJointOwnerNA] [bit] NULL,
[newbNameChange] [bit] NULL,
[newbDateCompleted] [datetime] NULL,
[newbSuitabilityStatus] [varchar](25) NULL,
[newbClientNumber] [varchar](15) NULL,
[newbCheckPayable] [bit] NULL,
[newbMSANumber] [varchar](11) NULL,
[newbPrincipalReviewer] [varchar](10) NULL,
[newbCreationDate] [datetime] NULL,
[newbAnyExistingPolicies] [varchar](1) NULL,
[newbCreatedBy] [varchar](50) NULL,
[newbReplaceExistingPolicy] [varchar](1) NULL,
[newbFormsVerified] [bit] NULL,
[newbTransfer1035] [varchar](1) NULL,
[newbFormsComment] [varchar](500) NULL,
[newbADRequired] [bit] NULL,
[newbAssignedCSRID] [varchar](10) NULL,
[newbBackupWithholding] [varchar](1) NULL,
[newbSuitabilityApprovedDate] [datetime] NULL,
[newbExchangeInternal] [bit] NULL,
[newbAnnuityDate] [varchar](20) NULL,
[newbAnnuityDateOverride] [bit] NULL,
[newbAnnuityOption] [varchar](1) NULL,
[newbSpecialRequest] [varchar](500) NULL,
[newbSpecialRequestNA] [bit] NULL,
[newbFraudAccepted] [bit] NULL,
[newbHireDate] [varchar](20) NULL,
[newbAppless] [bit] NULL,
[newbMailToClient] [bit] NULL,
[newbPGR] [bit] NULL,
[newbDataLock] [varchar](8) NULL,
[amlsCode] [varchar](1) NULL,
[newbFEPlanCodeIndicator] [bit] NULL,
[newbFEPlanCodeDate] [varchar](10) NULL,
[newbBestPlusClientID] [varchar](10) NULL,
[newbDetachedOfficeIndicator] [char](1) NULL,
[newbDetachedOfficeCode] [varchar](5) NULL,
[newbPreviousWFM] [bit] NULL,
[newbARDForm1] [bit] NULL,
[newbARDForm2] [bit] NULL,
[newbARDForm3] [bit] NULL,
[newbARDForm4] [bit] NULL,
[newbARDForm5] [bit] NULL,
[newbPSO] [bit] NULL,
CONSTRAINT [PKC_NewBiz_cnewbID] PRIMARY KEY NONCLUSTERED
(
[newbID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 95) ON [PRIMARY]
) ON [PRIMARY]
You can use mysql workbench to do so, I converted mssql database to MySQL database.
Here is the link to tutorial, it has all the details along with screenshots.

SQL INSERT statement conflicted with the CHECK constraint

I am getting this error
InsertRecord(InsertRow): HResult of -2147217873 (80040e2f)
Error Source: Microsoft OLE DB Provider for SQL Server Error
Description : The INSERT statement conflicted with the CHECK constraint CK_ContactName. The conflict occurred in database EPIC.7.5_GR_SM_ETLTRAINING; table dbo.ContactName.
The Statements
CREATE TABLE [dbo].[ContactName](
[UniqContactName] [dbo].[DM_UNIQID] IDENTITY(65536,1) NOT NULL,
[UniqFixedContactName] [dbo].[DM_UNIQID] NOT NULL,
[UniqEntity] [dbo].[DM_UNIQID] NOT NULL,
[LkPrefix] [dbo].[DM_PREFIX] NOT NULL,
[FullName] [dbo].[DM_NAME] NOT NULL,
[FirstName] [varchar](30) NOT NULL,
[MiddleName] [varchar](16) NOT NULL,
[LastName] [varchar](30) NOT NULL,
[LkSuffix] [dbo].[DM_SUFFIX] NOT NULL,
[DescriptionOf] [dbo].[DM_DESC_050] NOT NULL,
[Title] [dbo].[DM_TITLE] NOT NULL,
[Department] [dbo].[DM_DEPARTMENT] NOT NULL,
[UniqContactAddressMain] [dbo].[DM_UNIQID] NOT NULL,
[UniqContactAddressEmployer] [dbo].[DM_UNIQID] NOT NULL,
[UniqContactNumberMain] [dbo].[DM_UNIQID] NOT NULL,
[UniqContactNumberEmailMain] [dbo].[DM_UNIQID] NOT NULL,
[ContactMethodCode] [char](1) NOT NULL,
[InformalHeading] [varchar](50) NOT NULL,
[FormalHeading] [varchar](50) NOT NULL,
[BirthDate] [dbo].[DM_DATE] NULL,
[GenderCode] [char](1) NOT NULL,
[SSN] [char](9) NOT NULL,
[MaritalStatusCode] [char](1) NOT NULL,
[RelationToInsuredCode] [char](2) NOT NULL,
[LkLanguage] [dbo].[DM_LANGUAGE] NOT NULL,
[Comments] [dbo].[DM_COMMENT] NOT NULL,
[BillingDeliveryCode] [char](1) NOT NULL,
[ServicingDeliveryCode] [char](1) NOT NULL,
[MarketingDeliveryCode] [char](1) NOT NULL,
[CategoryCode] [char](1) NOT NULL,
[EmployerName] [dbo].[DM_NAME] NOT NULL,
[LkOccupation] [dbo].[DM_OCCUPATION] NOT NULL,
[HiredDate] [dbo].[DM_DATE] NULL,
[YearsEmployed] [smallint] NULL,
[YearsPriorEmployer] [smallint] NULL,
[FEIN] [char](9) NOT NULL,
[DUNSNumber] [char](9) NOT NULL,
[CdNAICSCode] [char](6) NOT NULL,
[CdSICCode] [char](8) NOT NULL,
[BusinessTypeCode] [char](2) NOT NULL,
[BusinessTypeOtherDesc] [varchar](50) NOT NULL,
[NumberEmployees] [smallint] NULL,
[NumberMembersManagers] [int] NULL,
[BusinessStartedDate] [datetime] NULL,
[NatureOfBusinessCode] [char](2) NOT NULL,
[NatureOfBusinessOtherDesc] [varchar](50) NOT NULL,
[CreditBureauNameCode] [char](5) NOT NULL,
[CreditBureauNameOtherDesc] [varchar](50) NOT NULL,
[CreditBureauIDNumber] [varchar](30) NOT NULL,
[DriverLicenseNumber] [varchar](25) NOT NULL,
[LicensedState] [char](4) NOT NULL,
[LicensedDate] [datetime] NULL,
[LicensedMADate] [dbo].[DM_DATE] NULL,
[DriverTypeCode] [char](1) NOT NULL,
[GoodStudentCode] [char](1) NOT NULL,
[DriverTrainingCode] [char](1) NOT NULL,
[AccidentPreventionCourseDate] [dbo].[DM_DATE] NULL,
[CommercialExperienceBeganDate] [dbo].[DM_DATE] NULL,
[MatchClientNameOf] [smallint] NOT NULL,
[InsertedByCode] [dbo].[DM_INSERTUPDATEBYCODE] NOT NULL,
[InsertedDate] [dbo].[DM_DATETIME] NOT NULL,
[UpdatedByCode] [dbo].[DM_INSERTUPDATEBYCODE] NOT NULL,
[UpdatedDate] [dbo].[DM_DATETIME] NULL,
[Flags] [dbo].[DM_FLAGS] NOT NULL,
[ts] [datetime] NOT NULL,
[SIN] [char](9) NOT NULL,
[BusinessNumber] [varchar](30) NOT NULL,
[BusinessIDNumber] [varchar](30) NOT NULL,
[IBCCode] [char](6) NOT NULL,
CONSTRAINT [PK_ContactName] PRIMARY KEY NONCLUSTERED ALTER TABLE [dbo].[ContactName]
WITH CHECK ADD CONSTRAINT [CK_ContactName]
CHECK ((
[UniqContactName]=(-1)
AND [UniqEntity]=(-1)
OR [UniqContactName]>(-1)
AND [UniqEntity]>(-1)
))
GO
I have checked contactName db and all the rows from uniqueContactName all have a value above 65000, then for UniqEntity they all are above 65000 as well.
Does anyone have an idea why this would fail?

SQL Error : "Incorrect syntax near"

I have a database that is connected to SQL Server 2008, I am getting an error when printing database : Printing aborted! Error 37000 (Microsoft OLE DB Provider for ODBC Drivers) - [Microsoft] [ODBC SQL Server Driver] [SQL Server] [Incorrect syntax near 'TEMP_TAB_SHEET_U17'.
Details script as below :
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [data].[TEMP_TAB_SHEET_U17](
[TAL] [varchar](30) NULL,
[Phase] [smallint] NOT NULL,
[SHT] [varchar](30) NULL,
[PreferedSYS] [varchar](30) NULL,
[sysdesc] [varchar](100) NULL,
[EquipmentNumber] [varchar](30) NULL,
[TaskNumber] [varchar](30) NULL,
[TaskId] [int] NULL,
[OTdescription] [varchar](50) NULL,
[OTremark] [varchar](50) NULL,
[Estimated_Man_Hours] [float] NULL,
[EquipmentId] [int] NULL,
[EquipmentDescription] [varchar](50) NULL,
[TAA_ID] [int] NULL,
[UserGroup] [varchar](30) NULL,
[MODULE] [varchar](30) NULL,
[ModuleDesc] [varchar](50) NULL,
[SHTTitle1] [varchar](50) NULL,
[SHTTitle2] [varchar](50) NULL,
[SHTTitle3] [varchar](50) NULL,
[SHTTitle4] [varchar](50) NULL,
[SHTDescription] [varchar](50) NULL,
[SHTNbSections] [int] NULL,
[NbMaxTasksPerSheet] [int] NULL,
[S1_PH] [varchar](30) NULL,
[S1_M] [varchar](30) NULL,
[S1_PF] [varchar](30) NULL,
[S2_PH] [varchar](30) NULL,
[S2_M] [varchar](30) NULL,
[S2_PF] [varchar](30) NULL,
[S3_PH] [varchar](30) NULL,
[S3_M] [varchar](30) NULL,
[S3_PF] [varchar](30) NULL,
[SHTFooterTitle1] [varchar](50) NULL,
[SHTFooterTitle2] [varchar](50) NULL,
[SHTFooterTitle3] [varchar](50) NULL,
[SHTFooterTitle4] [varchar](50) NULL,
[SHTFooterTitle5] [varchar](50) NULL,
[SHTFooterTitle6] [varchar](50) NULL,
[SHTFooterTitle7] [varchar](50) NULL,
[SHTFooterTitle8] [varchar](50) NULL,
[SHTFooterTitle9] [varchar](50) NULL,
[SHTFooterTitle10] [varchar](50) NULL,
[SHTFooterTitle11] [varchar](50) NULL,
[SHTFooterTitle12] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [data].[TEMP_TAB_SHEET_U17] ADD DEFAULT ((0)) FOR [Phase]
GO
Query completed running with the error :
Msg 2714, Level 16, State 6, Line 2
There is already an object named 'TEMP_TAB_SHEET_U17' in the database.
Msg 1781, Level 16, State 1, Line 2
Column already has a DEFAULT bound to it.
Msg 1750, Level 16, State 0, Line 2
Could not create constraint. See previous errors.
How to solve this problem.
Thank you in advance.
Awan
Have you tried to set the constrain on creation:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [data].[TEMP_TAB_SHEET_U17](
[TAL] [varchar](30) NULL,
[Phase] [smallint] NOT NULL DEFAULT 0,
...
....
GO
SET ANSI_PADDING OFF
GO

SSIS get all data from A table that are not in B table and inserted it in table B

i have two table and i need to create SSIS package "data flow task"
table A and table B, i need to create SSIS package that always insert the data that are not in table B from table A into table B (based on badgeno in A and badgeno_ID in B ). any thought and helps plz?
CREATE TABLE [dbo].[A](
[firstname] [nvarchar](100) NULL,
[mobile] [nvarchar](50) NULL,
[note] [nvarchar](500) NULL,
[city] [nvarchar](255) NULL,
[badgeno] [nvarchar](50) NULL,
[lastname] [nvarchar](100) NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[B](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](100) NULL,
[LastName] [nvarchar](100) NULL,
[DateOfBirth] [datetime] NULL,
[FirmID] [int] NULL,
[Phone] [varchar](50) NULL,
[Mobile] [varchar](50) NULL,
[EMail] [nvarchar](100) NULL,
[EmployeeNr] [nvarchar](10) NULL,
[Note] [nvarchar](500) NULL,
[PhonePrivate] [varchar](50) NULL,
[StreetAddress] [nvarchar](255) NULL,
[Zip] [nvarchar](20) NULL,
[City] [nvarchar](255) NULL,
[Data] [nvarchar](500) NULL,
[UserName] [nvarchar](50) NULL,
[Password] [nvarchar](50) NULL,
[ADGUID] [nvarchar](50) NULL,
[Language] [nvarchar](50) NULL,
[Theme] [nvarchar](30) NULL,
[DefaultZone] [int] NULL,
[Bed] [nvarchar](50) NULL,
[badgeNO_ID] [nvarchar](50) NULL,
[RegisteredBy] [nvarchar](50) NOT NULL,
[Registered] [datetime] NOT NULL,
[LastUpdatedBy] [nvarchar](50) NOT NULL,
[LastUpdated] [datetime] NOT NULL,
[DefaultView] [nvarchar](50) NULL,
[ExpandTagList] [bit] NULL,
[PrintEmergencyReport] [bit] NULL,
[EmergencyReportPath] [nvarchar](255) NULL)
Drag and drop an Execute Sql Task and put the following t-sql query in there. Jobs a gooden.
INSERT INTO [dbo].[B]
([firstname] , [mobile], [note], [City], [badgeNO_ID] , [LastName])
SELECT [A].[firstname]
, [A].[mobile]
, [A].[note]
, [A].[City]
, [A].[badgeno]
, [A].[LastName]
FROM [dbo].[A]
WHERE NOT EXISTS (SELECT 1
FROM [dbo].[B]
WHERE [dbo].[A].[badgeno] = [dbo].[B].[badgeNO_ID])
Use an SSIS Lookup Transformation with "No Match" Output
http://msdn.microsoft.com/en-us/library/ms141821.aspx
https://www.simple-talk.com/sql/ssis/implementing-lookup-logic-in-sql-server-integration-services/

Subquery returned more than 1 value in insert statement

I need solution to fix this error Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I don't have subquery in my insert statement but still I am getting this error.
Code:
INSERT INTO enquiries_dtls(confdate,confname,region,enquiry,attendedby,dctname,
hospital,contactno,email,addr)
VALUES('10/04/2013',
'APAO',
'Delhi',
'test',
'test',
'test',
'test',
'123214',
'abc#abc.com',
'test')
DDL:
CREATE TABLE [dbo].[enquiries_dtls]
(
[sno] [int] IDENTITY(1,1) NOT NULL,
[Timestamp] [timestamp] NULL,
[confdate] [date] NULL,
[confname] [varchar](max) NULL,
[region] [varchar](50) NULL,
[enquiry] [varchar](max) NULL,
[attendedby] [varchar](50) NULL,
[dctname] [varchar](50) NULL,
[hospital] [varchar](50) NULL,
[contactno] [int] NULL,
[email] [varchar](50) NULL,
[addr] [varchar](max) NULL,
[stsupdate] [varchar](max) NULL,
[dtupdate] [date] NULL,
[closingdate] [date] NULL,
[clsedby] [varchar](50) NULL,
[revenue] [varchar](50) NULL,
[apprstatus] [varchar](50) NULL,
[clsed] [varchar](50) NULL,
[enqId] [varchar](50) NULL
);