SQL server truncated data errors

 

“String or binary data would be truncated”, an error raised by SQL server when trying to update or insert data into a column that is bigger than that column can accommodate.

On my wish list for SQL server for a long time has been that this error should provide the column that raised the error as part of the reported error. Our Microsoft ERP system has very wide tables, approximately two hundred columns in some of them. When this error happens, it becomes a pain to track down the failing column update.

The only way I’ve got to do this at the moment is to add the LEN() function around every possible culprit and check the returned lengths manually against the schema. Whilst this works, it takes a long time, just for lack of the column name in the error raised.

eConnect “Customer is Inactive, you must Activate the customer to enter transactions”

Started looking at the eConnect integration with one of our websites today. We get the following error when the customer has been marked as inactive. Inactive in our world is something the finance department quantity, however we obviously want to still accept sales and ask questions later.

The problem is when the customer places the order we get the eConnect error which makes business sense,

WebDocumentTransport.FileProcessingException: Error processing order: 39646 ---> System.Exception: Microsoft.GreatPlains.eConnect.eConnectException: Sql procedure error codes returned: Error Number = 1790 Stored Procedure taSopHdrIvcInsert Error Description = Customer is Inactive, you must Activate the customer to enter transactions Node Identifier Parameters: taSopHdrIvcInsert SOPNUMBE = 3899646 SOPTYPE = 2 Related Error Code Parameters for Node : taSopHdrIvcInsert CUSTNMBR = TEST

 

First I checked to see if there was a field in the XML that overrides this behaviour, there was not so next I thought I could use the econnect pre and post stored procedures to get around this. The procedures, taSopHdrIvcInsertPre and taSopHdrIvcInsertPost, supposedly run before and after the document is processed.

As I was seeking a simple rapid solution, I bunged some TSQL in to stash away the customer status if it was inactive, set customer as active and then restore the status afterwards in the post procedure.

Annoyingly this does not work. The taSopHdrIvcInsertPre never executes if the customer in inactive. I guess the error occurs before econnect hands off to taSopHdrIvcInsertPre. I admit this seems like a acceptable behaviour, just not the one I was seeking.

So looks like I have run the SQL procedures I wrote, before and after the sales document is created myself. Alternatively I have to go back to plan A that was to do the change through eConnect itself that might be the more correct way to handle this anyway.

Where are our successors?

Computer science & Electronic engineers shortage

Attending Design Means Business conference today, Ian Livingstone, co-founder of Games Workshop and now Life President of Eidos games brought up the subject of the skills shortage in the UK games industry. An industry worth staggering amounts of money it has to be said.

Ian hinted at the lack of support and understanding for the industry from the civil service, Government. Ian promoted that computer science should be taught in schools because ICT as it is currently taught is inadequate. Kids need to be introduced to more than how to operate Microsoft Office applications. If we are to supply the industry with the type of skills it demands.

Computer Science in schools

I do think kids need to understand more about how computers work, bits and all. Computers are now so pervasive in our lives that an understanding of how they work should put people in a good position for the many years ahead where they will be interacting with them in all their guises.

I had to chip in when it came to question time as I am seeing the same problem in the electronics industry. This was confirmed by those who came up to me later agreeing with my observations. Recruiting for a broad skilled electronic design engineer is turning out to be very difficult for me at the moment. During interviews what I think I am uncovering is that students of electronic engineering are less likely to have been experimenting with basic circuits in their bedrooms than in our generation. This results in them not knowing the basic building blocks required to design circuits. Could this be because Kids now have so many distractions competing for their time, such as smart phones, SMS text message conversations, very good video game consoles and handhelds, internet chat, social internet, Blue Ray DVD’s, many TV channels all day and night? In our youth, we had to entertain ourselves much more, for some kids this led to dismantling things and building things, often spending hours figuring out how things work. Is that is lost to this generation?

Perhaps the educational establishments are failing to teach what is actually required for industry? Some argue that the high calibre students are not longer attracted to engineering as the status and value of engineering has been slipping in society for many, many years.

How did our generation learn?

In the case of computers the 1980’s games only held so many hours of attention then you had to find other things to do like entering pages of computer code from magazines, working out what it was doing, tweaking it. Today software developer tooling is such that the developer is abstracted above the science of the machine and is more inclined to be dragging and dropping even if they do venture that far. An interest in computer science may never be germinated as computer science is never exposed.

In the electronics world, these days the hobbyist who picks up a copy of Make magazine or goes to instructables.com is faced with many electronics projects that are fun, however they are almost always backed with a microprocessor hobby board that makes it plug, program and play. This shortcuts the analogue circuit equivalent of these operations leaving little hope of developing analogue electronic engineers or RF engineers.

Inspirational software evangelists

What could be done to correct the situation we are in? The British excel at design and should be generating economic benefit from it.You may say the Government should invest in computer science and electronics in schools, instead perhaps it should be the private sector, computer games industry and electronics industries taking matters into their own hands. Ian said that they are sponsoring computer clubs at schools. This is a start, but I really have to ask about role models and inspiration. What was it that inspired a subject option choice or career aspiration when you were young? My guess is that this is usually though an individual who inspired you, a role model such as an unusually enthusiastic teacher or media role model. I cannot stress enough about the importance and impact that enthusiastic technology evangelists can have on children’s perceptions and acceptance of learning. The industry needs to find individuals who are good leaders, can inspire young people. Microsoft do this very effectively with their technology evangelists a handful of individuals who are good a public speaking and love what they do. Their role is to go around the internet and physical country enthusiastically talking to people about the Microsoft technology stack. Perhaps as electronic and software engineers, we should be putting our foot in the door of the computer clubs, kids social clubs using such inspirational individuals to inspire a next generation of wealth builders.

I remember when the Royal Institution Christmas lectures used to be shown with good TV schedule slots, and as there was not much choice kids ended up watching them, getting inspired by science & technology. They are now on after the kids have gone to sleep late evening and on an obscure TV channel. Does this tell us of the regard education of children has? Do you also remember how open university programs used to be on to fill gaps in TV scheduling? You would end up watching them, and often realise how interesting it was?

Education is competing with entertainment now more than ever before. Other developing market countries are pouring effort and cash into education where the kids are given more motivation to improve and less entertainment distractions. The gap is closing and we need to act to prevent electronic design and game design migrating to other countries.