473,320 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

User Defined Data Types Problem

Hi all,

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.

Any help is appreciated.

Thanks,
Ken

Jul 8 '06 #1
2 3693
ro**************@hotmail.com (ro**************@hotmail.com) 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, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 8 '06 #2
Ken,

If you want both 4 byte storage and 0 to 4294967295 range, you could
store an int stored_value = (your_value - 2147483648) and have a
computed column (cast(stored_value as bigint) + 2147483648). Not sure
if saving 4 bytes of storage is worth the effort in your case, but
sometimes it definitely is worth trying.

Good luck!

Jul 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Guilherme Pinto | last post by:
Hello. I am reading the book written by Bjarne Stroustrup called " The C++ Programming Language - Special Edition" and had a doubt which a think is really important to distinguish between the...
3
by: Kunle Odutola | last post by:
I have a database that tracks players for children's sports clubs. I have included representative DDL for this database at the end of this post. A single instance of this database supports...
1
by: Robbie | last post by:
Hi Guys Wonder if you could help me. Basically I produce an accounts package that uses a SQL 2000 DB as the RDBMS. I always instruct users to login as 'sa' and the relevant password when...
2
by: Miles Ashton | last post by:
A common request for enhancement to applications is to "make this field bigger". I know I've been caught with increasing a field size, and then spending hours debugging because another stored proc...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
2
by: Boris | last post by:
The .NET documentation talks about blittable and non-blittable types. While objects of type System::Object* are non-blittable it doesn't say anything about objects of user-defined classes. All the...
2
by: Les Stockton | last post by:
In VB6 you had a Type and End Type to define your own data types. Are the only ways to do this in VB.Net with enums, struct and class. How's the best way to define user defined types?
2
by: Jonathan Daugherty | last post by:
Hello, I'm trying to write a PL/PgSQL function whose sole parameter is an array whose element type is a type that I've created. For example: CREATE TYPE test_type AS (x bigint, y bigint); ...
3
by: vasili | last post by:
hello All, I have a simple issue. I defined a custom container, that encloses a std::list, which in turn holds objects that are a simple abstraction of a six position array. Now, i would like...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.