473,785 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INT Size

Hello All,

Short Version:

How large can a MS SQL Server INT become?

Long Version:

I have this SQL statement...

CREATE TABLE admin_tokens (
user_id varchar(27) NOT NULL default '',
elt varchar(16) NOT NULL default '',
token_index int(11) NOT NULL default '0'
CONSTRAINT PK_admin_tokens PRIMARY KEY (user_id, token_index)
);
And I get the following error:

java.sql.SQLExc eption: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Column or parameter #3: Cannot specify a column width
on data type int.

Is this a MS SQL server issue only? If I remove the (11) part it
works fine... but I'm not sure how large the int can be... I want to
make sure the database stops working in a couple of years.

Thanks!
--
Nathan
Jul 20 '05 #1
2 43398
Nathan Given (ng****@hotmail .com) writes:
Hello All,

Short Version:

How large can a MS SQL Server INT become?
The range for an int is from -2^31 to 2^31-1, that is a 32-bit signed
number.
Long Version:

I have this SQL statement...

CREATE TABLE admin_tokens (
user_id varchar(27) NOT NULL default '',
elt varchar(16) NOT NULL default '',
token_index int(11) NOT NULL default '0'
CONSTRAINT PK_admin_tokens PRIMARY KEY (user_id, token_index)
);
And I get the following error:

java.sql.SQLExc eption: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Column or parameter #3: Cannot specify a column width
on data type int.

Is this a MS SQL server issue only? If I remove the (11) part it
works fine... but I'm not sure how large the int can be... I want to
make sure the database stops working in a couple of years.


I don't know the full story about the int(11), but I've seen it
posts which appears to have been about MySQL. (People who use MySQL
posts this group for some reason.) So it may be proprietary for MySQL.
Then again, it could be in the ANSI Standard for all I know.

In any case, int(11) is not supported in SQL Server. Instead you have
these integer types to choose from:

tinyint - unsigned 8-bit (0-255)
smallint - signed 16-bit (-32768 - 32767)
int - signed 32-bit
bigint - signed 64-bit.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2


Erland Sommarskog wrote:


In any case, int(11) is not supported in SQL Server. Instead you have
these integer types to choose from:

tinyint - unsigned 8-bit (0-255)
smallint - signed 16-bit (-32768 - 32767)
int - signed 32-bit
bigint - signed 64-bit.


While they are not technically integer types, these SQL Server types can also be used to store integer values:

NUMERIC(1), NUMERIC(2) and so on up to NUMERIC(38). In SQL Server, NUMERIC(k) is the same as NUMERIC(k,0), DECIMAL(k), or DECIMAL(k,0).

The (11) allowed by MySql is an "optional display width specification". Types that know what they are supposed to look like? Sounds like a
bad idea to me, non-portability aside.

Steve Kass
Drew University
Jul 20 '05 #3

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

Similar topics

3
7109
by: Marti | last post by:
Dear everyone, Its my understanding that IE6 now uses a default text-size of "Small" rather than IE5's "Medium". Since I have used relative font-sizes (usually in ems) on all my sites, I am now getting reports of "your fonts are too tiny" from various users. Of course, the sites still look fine if those users set their text-size to medium, but face it -- most people don't even know thats an option.
25
7595
by: Matthias | last post by:
Hi, I am just reading that book by Scott Meyers. In Item 4 Meyers suggests to always use empty() instead of size() when probing for emptyness of STL containers. His reasoning is that size() might take linear time on some list implementations. That makes sense at first. However, he also says this at the very beginning: "That being the case , you might wonder why one construct should be preferred to the other, especially in view of the...
9
3779
by: Dr John Stockton | last post by:
Assuming default set-ups and considering all reasonable browsers, whatever that may mean, what should an author expect that his readers in general will see (with visual browsers) for a page with body like <br><br> Abc <font size=+1> Abc <font size=+1> Abc <font size=+1> Abc <font size=+1> Abc <font size=+1>
4
3686
by: Erik Hendrix | last post by:
Hi, I have a quick question, when one sets the prefetch size = extent size, then when doing a backup we will have 1 agent (db2bm) doing the reads. If we have prefetch size a multiple of extent size AND we have multiple containers and/or PARALLEL_IO set then not db2bm but the db2 prefetchers will read the data. Now no matter which one reads the data, it will still be read in 1 extent size. Wouldn't it thus be much more efficient to...
4
3496
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
27
31457
by: Deephay | last post by:
Greetings all, I have a program that used the realloc() function to change the allocated size of a buffer, the program works with some arguments, but with some other arguments, it will show me the error message like: *** glibc detected *** realloc(): invalid next size: 0x0804c3a8 *** and then I inserted a perror("realloc") to see what happend, it says that:
8
10169
by: redefined.horizons | last post by:
I would like to have an array declaration where the size of the array is dependent on a variable. Something like this: /* Store the desired size of the array in a variable named "array_size". */ unsigned short int array_size = 25; /*Declare an array named "numbers" using the variable initialized above. */ unsigned short int numbers;
7
43938
by: carterweb | last post by:
This is how I do it now. 1. Determine the dimensions of the rectangle. 2. Set a my font size to a fixed maximum size. 3. Apply the font my string and measure the string using the graphics object. 4. If string size is less than the size of the rectangle, we are done.
18
25006
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin, that IE7 does not seem to offer any way to control the font size of a text input element.
27
3242
by: 1001 Webs | last post by:
I am trying to make my style sheet as compatible as possible and I'm getting a bit confused here. I've read that the best size for font-size would be 76.1%; due to shortcomings in the way both IE and Opera render that attribute. Is this correct?
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.