1

لا يمكن حذف الحسابات في دليل الحسابات

  • retag add tags

عند محاولة حذف حساب او اكثر بدليل الحسابات .. لا يستجيب البرنامج ويرفض الحذف!
و هذا جزء من اللوج الذي يظهر

 delete from Account where id='<byte[]>'
com.microsoft.sqlserver.jdbc.SQLServerException: The query processor ran out of stack space during query optimization. Please simplify the query.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
Ahmed Farouk's avatar
81
Ahmed Farouk
asked 2018-07-07 11:13:08 +0200
Ahmed Qasid's avatar
5.8k
Ahmed Qasid
updated 2018-12-23 05:09:46 +0200
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

يحدث هذا بالنسبة لقواعد البيانات القديمة فقط ..
ويكون الحل من خلال تشغيل جملة الـ SQL التالية بقاعدة البيانات .. ثم نسخ نتائجها (النتيجة عبارة عن جملة SQL) وتشغيلها بصفحة أخرى لنفس قاعدة البيانات.

with x as (
SELECT  obj.name AS FK_NAME,
   sch.name AS [schema_name],
   tab1.name AS [table],
   col1.name AS [column],
   tab2.name AS [referenced_table],
   col2.name AS [referenced_column]
FROM sys.foreign_key_columns fkc
INNER JOIN sys.objects obj
   ON obj.object_id = fkc.constraint_object_id
INNER JOIN sys.tables tab1
   ON tab1.object_id = fkc.parent_object_id
INNER JOIN sys.schemas sch
   ON tab1.schema_id = sch.schema_id
INNER JOIN sys.columns col1
   ON col1.column_id = parent_column_id AND col1.object_id = tab1.object_id
INNER JOIN sys.tables tab2
   ON tab2.object_id = fkc.referenced_object_id
INNER JOIN sys.columns col2
   ON col2.column_id = referenced_column_id AND col2.object_id = tab2.object_id
)
select 'alter table '+[table]+' drop constraint '+FK_NAME from x where referenced_table = 'account' and [table] in ( 'invitem','Contractor','AccountBalance','LedgerTransLine','Customer','Supplier','ThirdParty')

Ahmed Farouk's avatar
81
Ahmed Farouk
answered 2018-07-07 11:16:34 +0200
Ahmed Qasid's avatar
5.8k
Ahmed Qasid
updated 2018-07-08 10:35:31 +0200
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer