1

لا يمكن حذف التقارير عند بعض العملاء، فما الحل؟

لا يستجيب النظام لحذف التقارير عند بعض العملاء؟

Eldabbas's avatar
9.1k
Eldabbas
asked 2019-02-20 03:47:17 +0200, updated 2019-02-20 06:27:54 +0200
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Try the following instructions:
Stop the server (Tomcat)
Execute the following SQL Query

while(exists(select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS t left join INFORMATION_SCHEMA.KEY_COLUMN_USAGE k on k.CONSTRAINT_NAME = t.CONSTRAINT_NAME
where CONSTRAINT_TYPE='FOREIGN KEY' and COLUMN_NAME in ('attachment_id','attachment1_id','attachment2_id','attachment3_id','attachment4_id','attachment5_id','attachment6_id','mainFile_id')))
begin
 declare @sql nvarchar(2000)
 SELECT TOP 1 @sql=('ALTER TABLE ' + t.TABLE_SCHEMA + '.[' + t.TABLE_NAME
           + '] DROP CONSTRAINT [' + t.CONSTRAINT_NAME + ']')
 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS t left join INFORMATION_SCHEMA.KEY_COLUMN_USAGE k on k.CONSTRAINT_NAME = t.CONSTRAINT_NAME
 where CONSTRAINT_TYPE='FOREIGN KEY' and COLUMN_NAME in ('attachment_id','attachment1_id','attachment2_id','attachment3_id','attachment4_id','attachment5_id','attachment6_id','mainFile_id')
 begin transaction x
 exec (@sql)
 print @sql
 commit transaction x
end

Restart the server.

Eldabbas's avatar
9.1k
Eldabbas
answered 2019-02-20 03:49:46 +0200, updated 2019-02-20 03:52:24 +0200
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer