Oslo 오류 설명“M2037 : SQL 생성 내부 오류 : 변수의 생성기 누락”?

StackOverflow https://stackoverflow.com/questions/253746

  •  05-07-2019
  •  | 
  •  

문제

Microsoft Oslo SDK CTP 2008 (Intellipad 사용)에서 다음 코드는 잘 구성됩니다.

module T {

    type A {
        Id : Integer32 = AutoNumber();
    } where identity Id;

    As : A*;

    type B {
        Id : Integer32 = AutoNumber();
//        A : A;
//    } where A in As && identity Id;
    } where identity Id;

    Bs : B*;

    type C {
        Id : Integer32 = AutoNumber();
        B : B;
    } where B in Bs && identity Id;

    Cs : C*;

}

다음과 같은 SQL 출력에 도달합니다.

set xact_abort on;
go

begin transaction;
go

set ansi_nulls on;
go

create schema [T];
go

create table [T].[As]
(
    [Id] int not null identity,
    constraint [PK_As] primary key clustered ([Id])
);
go

create table [T].[Bs]
(
    [Id] int not null identity,
    constraint [PK_Bs] primary key clustered ([Id])
);
go

create table [T].[Cs]
(
    [Id] int not null identity,
    [B] int not null,
    constraint [PK_Cs] primary key clustered ([Id]),
    constraint [FK_Cs_B_T_Bs] foreign key ([B]) references [T].[Bs] ([Id])
);
go

commit transaction;
go

그러나 다음과 같이 모듈 T에서 주석 선을 변경 한 후

        A : A;
    } where A in As && identity Id;
//    } where identity Id;

오류 메시지 "M2037 : SQL 생성 내부 오류 : 변수 'A'에 대한 생성기 누락 된 발전기가 표시됩니다 (Intellipad의 Reach SQL Window에).

어떤 아이디어?

안부, 탐버그

도움이 되었습니까?

해결책

당신이 원하는 것은 다음과 같습니다.

type A {
    Id : Integer32 = AutoNumber();
} where identity Id;

As : A*;

type B {
    Id : Integer32 = AutoNumber();
    A : A;
} where identity Id;

Bs : (B where value.A in As)*;

type C {
    Id : Integer32 = AutoNumber();
    B : B;
} where identity Id && B in Bs;

Cs : (C where value.B in Bs)*;

제약 조건은 여기의 유형이 아니라 외부에 있습니다. 유형의 제약이 있지만 하나 이상의 관계를 깊이 깊게 갈 수없는 경우 비슷한 코드를 얻을 수있었습니다. 그것들을 외부로 옮기는 것은 올바른 것처럼 보이며 예상 도달 범위 SQL을 생성합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top