An internal SQL server error occurs in MSSQL. (Smelly bug)

Source: Internet
Author: User

Server: Message 8624, level 16, status 1, row 442
Internal SQL server error.

 

After two days of being depressed, the problem was finally solved. Write down

The customer suddenly responded to the [customer order] the day before yesterday, and there was an "internal error" when it was well used. The trace found that it was a MSSQL error. The Code is as follows:

Set nocount on

Declare
@ Mm_key uniqueidentifier

Select
@ Mm_key = '{50a5a02d-0ca7-4864-958a-63205d29e42a }'

Declare @ danjukey uniqueidentifier

Select @ danjukey = @ mm_key

Delete f_pzjl_d
From mak_gongchengpzjl f_pzjl
Inner join mak_gongchengpzjl_d f_pzjl_d on f_pzjl_d.fformkey = f_pzjl.fformkey
Inner join mak_wuliaogcpz f_pz_m on f_pz_m.fformkey = f_pzjl.fgongcpzkey
Left join sal_custorder_d od_d on f_pzjl.fformkey = od_d.fgongchengpzkey
Where f_pzjl.fownsformkey = @ danjukey -- <1>
And (od_d.fkey is null
Or od_d.fwuliaokey <> f_pz_m.fwuliaokey)

I tried to replace the constant with @ danjukey of <1> or @ mm_key. I replaced @ danjukey with @ mm_key and solved the problem temporarily. Depressed.

Today, the customer responded that the [purchase order] had the same problem. I thought this time I should not be so fooled, so I checked it carefully. I have been searching online for a long time. I couldn't find it. Suddenly I found it when I looked at the code.

Delete f_pzjl_d
From mak_gongchengpzjl f_pzjl
Inner join mak_gongchengpzjl_d f_pzjl_d on f_pzjl_d.fformkey = f_pzjl.fformkey
Inner join mak_gongchengpzjl_d_sl f_pzjl_d_sl on f_pzjl_d_sl.fkey = f_pzjl_d.fkey -- This section contains many
Inner join mak_wuliaogcpz f_pz_m on f_pz_m.fformkey = f_pzjl.fgongcpzkey
Left join sal_custorder_d od_d on f_pzjl.fformkey = od_d.fgongchengpzkey
Where f_pzjl.fownsformkey = @ mm_key
And (od_d.fkey is null
Or od_d.fwuliaokey <> f_pz_m.fwuliaokey)

Conclusion:

The discovery is just that. Therefore, we found that the primary keys of mak_gongchengpzjl_d and mak_gongchengpzjl_d_sl have cascade relationships. Once removed, we finally found the problem... you can feel at ease.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.