Re: User Defined Data Types Problem



royaldothighness@xxxxxxxxxxx (royaldothighness@xxxxxxxxxxx) writes:
I defined unsigned_int in my database, which uses unsigned_int_range
rule. The unsigned_int_range rule is defined as follows:
@unsigned_int >=0 and @unsigned_int <=4294967295

(4294967295 = 0xFFFFFFFF)

The storage size is 4 bytes.

One of the tables in the database contains a field that is of type
unsigned_int.

When I try to add a new record into the table (ex: using the Enterprise
Manager), it always fails in the unsigned_int field if I enter a value
greater than 2147483647 (which is 0x7FFFFFFF) all the way to 4294967295
(0xFFFFFFFF). The Enterprise Manager shows the following message:

"The value you entered is not consistent with the data type or
length of the column, or over grid buffer limit."

What is wrong here? The 4-byte storage should be good for any value
from 0 to 4294967295.

Since you mention Enterprise Manager, I assume that you use SQL 2000.

To define a user-defined data type with that range you would have to
to base it on bigint or decimal(10, 0). You cannot use int as a base,
since int is signed.

In SQL 2005, you could define your unsigned int throught the CLR, although
I doubt that it would be worth the pain.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Datetime or GPS format
    ... Join the Sacramento SQL Server User Group on LinkedIn ... each row i save approx 1 TB of storage which is quite huge for me. ... good for INT cols also. ... data will be converted into GPS directly ... ...
    (microsoft.public.sqlserver.programming)
  • Re: Datetime or GPS format
    ... Join the Sacramento SQL Server User Group on LinkedIn ... each row i save approx 1 TB of storage which is quite huge for me. ... good for INT cols also. ... data will be converted into GPS directly ... ...
    (microsoft.public.sqlserver.programming)
  • enterprise manager error
    ... When trying to modify or add a table using enterprise manager I got this ... not enough storage is available to complete this ... I Regestred my SQL server 2000 on another enterprise manager in a second ...
    (microsoft.public.sqlserver.clients)
  • Re: WHERE clause applies to right-hand table of LEFT JOIN
    ... it's always best to specify INNER JOIN ... T1_PK int NOT NULL ... CONSTRAINT FK_T2_T1 FOREIGN KEY ... The SQL Server cost-based optimizer is very good at generating efficient ...
    (microsoft.public.sqlserver.server)
  • Re: WHERE clause applies to right-hand table of LEFT JOIN
    ... it's always best to specify INNER JOIN ... T1_PK int NOT NULL ... CONSTRAINT FK_T2_T1 FOREIGN KEY ... The SQL Server cost-based optimizer is very good at generating efficient ...
    (microsoft.public.access.queries)