Results 1 to 5 of 5

Thread: SQL7 BUG???

  1. #1
    Alex Bajenoff Guest

    SQL7 BUG???


    Sorry for my bad English
    I have error 403
    this what i did:
    CREATE RULE udr_test AS @test & 0xFFFFFFF8 = 0
    go

    exec sp_addtype ud_test, "int", "NOT NULL"
    exec sp_bindrule udr_test, ud_test

    CREATE TABLE t_test (
    f1 int IDENTITY(1,1),
    f2 ud_test NOT NULL,
    CONSTRAINT t_PK
    PRIMARY KEY ( f1 )
    )
    go

    INSERT t_test VALUES ( 2 )
    go

    Server: Msg 403, Level 16, State 1, Line 1
    Invalid operator for data type. Operator equals boolean AND, type equals varbinary.

    It's bug ?

  2. #2
    Ray Miao Guest

    SQL7 BUG??? (reply)

    It's not sql 7 bug instead of your code. You'll be set by adding 'go' after two exec commands.


    ------------
    Alex Bajenoff at 3/19/99 3:23:48 AM


    Sorry for my bad English
    I have error 403
    this what i did:
    CREATE RULE udr_test AS @test & 0xFFFFFFF8 = 0
    go

    exec sp_addtype ud_test, "int", "NOT NULL"
    exec sp_bindrule udr_test, ud_test
    go -- You need it here!!!

    CREATE TABLE t_test (
    f1 int IDENTITY(1,1),
    f2 ud_test NOT NULL,
    CONSTRAINT t_PK
    PRIMARY KEY ( f1 )
    )
    go

    INSERT t_test VALUES ( 2 )
    go

    Server: Msg 403, Level 16, State 1, Line 1
    Invalid operator for data type. Operator equals boolean AND, type equals varbinary.

    It's bug ?

  3. #3
    Alex Bajenoff Guest

    SQL7 BUG??? (reply)

    I add go and have the same result.

    ------------
    Alex Bajenoff at 3/19/99 3:23:48 AM


    Sorry for my bad English
    I have error 403
    this what i did:
    CREATE RULE udr_test AS @test & 0xFFFFFFF8 = 0
    go

    exec sp_addtype ud_test, "int", "NOT NULL"
    exec sp_bindrule udr_test, ud_test

    CREATE TABLE t_test (
    f1 int IDENTITY(1,1),
    f2 ud_test NOT NULL,
    CONSTRAINT t_PK
    PRIMARY KEY ( f1 )
    )
    go

    INSERT t_test VALUES ( 2 )
    go

    Server: Msg 403, Level 16, State 1, Line 1
    Invalid operator for data type. Operator equals boolean AND, type equals varbinary.

    It's bug ?

  4. #4
    Jonathan Huang Guest

    SQL7 BUG??? (reply)

    I think the problem is the SQL Server does not consider your
    user defined datatype ud_test as "int" so EXPLICITLY that it will
    fail when you perform bitwise AND. My approach is to cast(convert)
    data types within the rule and IT WORKS!! Besides, binary variables
    for bitwise AND must be 4 bites in size, i.e. = integer.


    CREATE RULE udr_test AS cast(@test & cast(0xfffffff8 as int) as int)= 0
    go

    exec sp_addtype ud_test, "int", "NOT NULL"
    exec sp_bindrule udr_test, ud_test


    CREATE TABLE t_test (
    f1 int IDENTITY(1,1),
    f2 ud_test,
    CONSTRAINT t_PK
    PRIMARY KEY ( f1 )
    )
    go

    INSERT t_test VALUES ( 2 )
    go




    ------------
    Alex Bajenoff at 3/22/99 2:05:43 AM

    I add go and have the same result.

    ------------
    Alex Bajenoff at 3/19/99 3:23:48 AM


    Sorry for my bad English
    I have error 403
    this what i did:
    CREATE RULE udr_test AS @test & 0xFFFFFFF8 = 0
    go

    exec sp_addtype ud_test, "int", "NOT NULL"
    exec sp_bindrule udr_test, ud_test

    CREATE TABLE t_test (
    f1 int IDENTITY(1,1),
    f2 ud_test NOT NULL,
    CONSTRAINT t_PK
    PRIMARY KEY ( f1 )
    )
    go

    INSERT t_test VALUES ( 2 )
    go

    Server: Msg 403, Level 16, State 1, Line 1
    Invalid operator for data type. Operator equals boolean AND, type equals varbinary.

    It's bug ?

  5. #5
    Alex Bajenoff Guest

    SQL7 BUG??? (reply)

    Jonathan thanks for your rep.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •