首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >解释奥斯陆错误"M2037: SQL生成内部错误:缺少变量生成器“?

解释奥斯陆错误"M2037: SQL生成内部错误:缺少变量生成器“?
EN

Stack Overflow用户
提问于 2008-10-31 14:38:04
回答 2查看 221关注 0票数 1

在Microsoft Oslo SDK CTP 2008 (使用Intellipad)中,以下代码可以很好地编译:

代码语言:javascript
复制
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*;

}

并产生以下Reach SQL输出:

代码语言:javascript
复制
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中的注释行后,如下所示

代码语言:javascript
复制
        A : A;
    } where A in As && identity Id;
//    } where identity Id;

将显示错误消息"M2037: SQL生成内部错误:缺少变量‘A’的生成器“(在Intellipad的Reach SQL窗口中)。

有什么想法吗?

向您致敬,坦伯格

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2008-10-31 18:37:29

我想你想要的是:

代码语言:javascript
复制
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)*;

请注意,约束是在外部类型上,而不是这里的类型上。当约束放在类型上时,我能够得到类似的代码,但不能深入到一个以上的关系。将它们移动到externs似乎是正确的,并生成预期的到达SQL。

票数 1
EN

Stack Overflow用户

发布于 2008-10-31 21:00:05

http://social.msdn.microsoft.com/Forums/en-US/oslo/thread/05103bf8-4e0f-4976-bcdd-2c724cb08738/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/253746

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档