What is the best way to delete this?
Deleting the record is just covering up the problem. Ultimately, you need to make sure your query can handle that if it ever comes up. Which you may have done in your changes that you made. I couldnât really follow exactly what was done to know for sure that it solved it.
You now know how to use the tryparse() function to convert to integers, so that should help you.
are there several companies in the DB? there is still a record with âUserIDâ text somewhere
Brandon,
I agree that deleting the data is just covering it up, but it is not a valid line of data. do you have any tips on how to delete it? When I look at DMT for Task, I struggle to find the unique identifiers to delete this specific record.
Olga,
There are 3 companies in the database.
Itâs his UserID! I didnât quite understand what he meant by the phrase. The error had his userID in the error. Thatâs the problem.
Yes, Key1 is normally the Quote number and somehow my userID fell into that column for this record. It is bad data and I want to delete it.
Look at the RelatedToFile (field) in the Task table I suspect that this is a record not related to a quote but to a different task.
Tasks in Epicor are used by many systems, cases, expenses, you name it.
I suspect that is indeed a valid a record (look at the RelatatedToFile field) it just insât valid for a quote. You should limit your query to filter that Task table on RelatedToFile =âQuoteHedâ (on top of all other suggestions here)
Related to file is âpersonâ
There you go, somehow (someone) entered a task in CRM related to a Person and thatâs how that task was created. That is a VALID epicor record, it is your job to remove it from your query by using a filter in RelatedToFile.
There are lots and lots of records like this in epicor one of them being the attachment table (thereâs an open letter I penned regarding these âgenericâ records somewhere around here that is pretty amusing) but regardless this is a valid record that you should not delete.
then you probably should check in all of them. SQL server does not care about company boundaries when it scans the table and stumble across incorrect data
The other two companies do not have any Key1 entries that are not integers.
This record was a mistake entry. When I try to delete it, I get this? Is there any way to force remove this record?
You canât delete tasks directly, you need to delete what itâs related toâŚ
That being said, this isnât the solution to your problem. So donât worry about deleting it.
Leave it alone it affects nothing donât try to delete records out of the data / database just walk away.
Another food for thought⌠Task is a silly table in that it has Company, RelatedToFile, Key1, Key2, Key3 and maybe TaskSeqNum also as keys for uniqueness. If the join were done with RelatedToFile = âQuoteHedâ along with the Key1, it likely wouldâve worked with Key1 being converted/parsed to an int. But for Task table especially, thereâs usually a column or multiple columns that identify the thing itâs related to in the format that it needs to be for a join. Not sure if joining using a non-indexed column performs worse than joining using a converted key, but Iâve never needed to know that up until now. Iâd be curious if anyone knows.
That is what execution plans are for. But I am not sure if it is available when query fails.