Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 SQL 6.5 issue

Author  Topic 

REEPER
Yak Posting Veteran

53 Posts

Posted - 2006-11-17 : 14:55:39
I'm trying to debug an issue executing an Insert statement. It always errors out but what's weird is that it errors saying it's try to execute an update statement: UPDATE FAILED

MCP, MCSD

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-17 : 15:00:48
That error is not a sql error it looks like a "handled" exception from an application so the error msgText could just be wrong. Post the statement that you are issuing (to sql server). If it is generated from an application, use sql profiler to capture the statement that is actually being sent to sql server and post that. Are there any triggers on the table?

Be One with the Optimizer
TG
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2006-11-17 : 15:07:38
Here is my call:
INSERT INTO OrderHead (SalesOrder, Company, BuilderNo, AcknowledgeDate, AtadRecv, AtadDate, FinComitDate, RecvDate, FinanceCode, ReqstDelivDate, MapRecvd, PurchOrdNo, OrderType, Series, Model, SCC_SMCNO, EffectivPrice, Status, SalesEngineer, BuyerName, DelivCity, DelivCounty, DelivAdd, DelivState, DelivZipCode, TranToCompany, ProdEngrType, TransPaySell, TransPayEst, JESModLoadRating, JESModExtrRating, JESModIntrRating, JESDoorDamage, JESWinDamage, JESRating, JESBldrSignd, JESRecvd, TransCst, UseTax, Loads, Units, SQFGarage, SQFHouse, CranePaySell, CranePayEst, CraneHrsEst, BoomLength, RequestCrane, CraneType, CrewPayEdit, CrewPaySell, CrewPayEst, CrewRateEst, CrewHrsEst, RequestCrew, CrewType, Promo2Pct, Promo1Amt, SCCBonCmsnAmt, SCCCmsnRate, SCCCmsnCalcOn, CalcdYTDSales, BldrCmsnAmt, BldrSrvResv, BldrCmsnRate, BldrCmsnCalcOn, BldrCmsnCalc, DownPayAmt, LabrFactr, BurdenRate, Adjust, OptPlntHrs, QuotPlntHrs, OptBPckMtrlCst, QuotBPckMtrlCst, OptAPckMtrlCst, QuotAPckMtrlCst, OptSetCost, QuotSetCost, OptSetRebate, QuotSetRebate, AdjustAmt, OptionAmt, QuoteAmt, ContractAmt, RelsFinSchd, LabrCalcBy, FirmOrdr, WindowSpecial, WindowManuf, SpecialItems, Comment, ShipTrim, Miles, BuyerLstName, OpenAmend, ProjectName, IsProject, ModelName, EstSalesEngrAsgn, QuoteNo, UpdateBy) VALUES ('19519', '19', '002168', '', '', '', '', '11/17/2006', ' ', '', 0, '10', 'O', 'SO', 'TS', '10396', '03/03/2006', 'A', 'RETTERATH ', 'THOMAS', 'ELLSTON', 'RINGGOLD', '1959 CLUB HOUSE CIRCLE', 'IA', '', '', '', 0, 0, '', '', '', '', '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, '', 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, '', '', '', '', 0, '', 0, '', 0, '', '', '','')

here is my message:
Command has been aborted.\r\nAttempt to insert the value NULL into column 'UpdateBy', table 'WHIBUILDER.dbo.ORDERHEAD'; column does not allow nulls. UPDATE fails.

MCP, MCSD
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-17 : 15:28:33
That error message still does not look like a sql error. If you paste that statement into a query analyzer window and run it I suspect you will receive a different error.

However, this error pretty clearly states that you are attempting to insert a NULL value into UpdateBy which apparently does not allow nulls. That is odd because your statement seems to be inserting an empty string rather than a NULL. Did you generate this statement from your app or did you capture this in profiler?


Be One with the Optimizer
TG
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2006-11-17 : 15:35:01
From a .NET app.
I've tried to insert my name as well same deal. It's like something is trying to overwrite the newly inserted value.

MCP, MCSD
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-17 : 15:43:36
That is why I suggested that you use sql profiler to capture the statement that your app is sending to sql server.
And you never answered the "trigger" question.

Be One with the Optimizer
TG
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-17 : 15:52:33
Was this existing code that just started breaking? or is this new stuff? And if it's new, why 6.5 . If I recall, 6.5 wasn't completely consistent in the way it handled empty strings and NULLs. I suppose that message could have been a sql error message back in the 6.5 days...I don't remember.

Be One with the Optimizer
TG
Go to Top of Page

REEPER
Yak Posting Veteran

53 Posts

Posted - 2006-11-17 : 16:08:12
Could some kind of stored procedure do this?

MCP, MCSD
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-11-17 : 17:56:55
>>Could some kind of stored procedure do this?
yes. Parameterized stored procedures is the way to go. IMHO

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -