У кого MS SQL Server 2008й, осталась ли ошибка 1785?
От: Аноним  
Дата: 28.08.08 10:54
Оценка:
Самому проверить пока нет возможности....
Скрипт простейший, ловит ошибку 1785 в MS SQL Server 2005м:

create table A
(
id int primary key
)
go
create table B
(
id int primary key,
aid1 int references A(id) on delete cascade,
aid2 int references A(id) on delete cascade
)
go

И вот необходимо этой ошибки избежать
Помогите пожалуйста =)
1785 delete cascade
Re: У кого MS SQL Server 2008й, осталась ли ошибка 1785?
От: danclax  
Дата: 28.08.08 12:52
Оценка:
Здравствуйте, Аноним, Вы писали:

А>Самому проверить пока нет возможности....

А>Скрипт простейший, ловит ошибку 1785 в MS SQL Server 2005м:

А>create table A

А>(
А>id int primary key
А>)
А>go
А>create table B
А>(
А>id int primary key,
А>aid1 int references A(id) on delete cascade,
А>aid2 int references A(id) on delete cascade
А>)
А>go

А>И вот необходимо этой ошибки избежать

А>Помогите пожалуйста =)

http://www.microsoft.com/heroeshappenhere/testdrive/sql-server-2008/default.mspx
По-моему любую кнопку можно нажимать. Например, нажми 2ую кнопку Test Drive
Re: У кого MS SQL Server 2008й, осталась ли ошибка 1785?
От: denisio_mcp  
Дата: 28.08.08 14:07
Оценка:
Здравствуйте, <Аноним>, Вы писали:

А>Самому проверить пока нет возможности....

А>Скрипт простейший, ловит ошибку 1785 в MS SQL Server 2005м:

да:

Msg 1785, Level 16, State 0, Line 1
Introducing FOREIGN KEY constraint 'FK__B__aid2__060DEAE8' on table 'B' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.

... << RSDN@Home 1.2.0 alpha 4 rev. 1088>>
Re[2]: У кого MS SQL Server 2008й, осталась ли ошибка 1785?
От: WaSh http://kxlm.blogspot.com/
Дата: 31.08.08 20:48
Оценка:
MS SQL 2008 Developer

Msg 1785, Level 16, State 0, Line 1
Introducing FOREIGN KEY constraint 'FK__B__aid2__1782BD48' on table 'B' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
... << RSDN@Home 1.2.0 alpha 4 rev. 1108>>
блог http://kxlm.blogspot.com/
Re: У кого MS SQL Server 2008й, осталась ли ошибка 1785?
От: Аноним  
Дата: 02.09.08 08:38
Оценка:
А>create table A
А>(
А>id int primary key
А>)
А>go
А>create table B
А>(
А>id int primary key,
А>aid1 int references A(id) on delete cascade,
А>aid2 int references A(id) on delete cascade
А>)
А>go

Это ByDesign вообще-то — с 2000-го. Дело в весёлом алгоритме определения циклов — FK проверяются как неориентированный граф. Из BOL ("Cascading Referential Integrity Constraints"):

The series of cascading referential actions triggered by a single DELETE or UPDATE must form a tree that contains no circular references. No table can appear more than one time in the list of all cascading referential actions that result from the DELETE or UPDATE. Also, the tree of cascading referential actions must not have more than one path to any specified table.

Насколько знаю, они никогда и не собирались этот алгоритм менять. Обходится INSTEAD OF DELETE триггером на table B.

удачи)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.