?
Solved

ASP datatype for SQL server Numeric [Command object]

Posted on 2002-06-28
5
Medium Priority
?
545 Views
Last Modified: 2008-03-10
I have a numeric field in sql server of size 10 [it says size 9 and precision - i am confused about this also]
In my asp code when i use adNumeric as below in command object i get an error, when i use adInteger instead it works withought any problem. I fear adInteger will have a limitation of 32767 numbers. I want it to take up to 10 digits of numbers.

cmdUsers.Parameters.Append cmdUsers.CreateParameter ("USERID",   adNumeric  ,adParamInput,10)
'cmdUsers is command object


Any help greatly appreciated.
0
Comment
Question by:sanjaykattimani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 800 total points
ID: 7116208
If you specify a numeric data type adNumeric in the Type argument, then you must also set the NumericScale and Precision properties.

cmdUsers.Parameters.Item(0).NumericScale = ???
cmdUsers.Parameters.Item(0).Precision = ???


hongjun
0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7116884
Given below is the text from books-online help of SQL 2K. If you are using adNumeric just for having more int space, you might get idea of max limits of each data type. Please don't confuse between Integer of vb and sql server. The Int in vb is sql server's smallint and long in vb is sql server's int.

---

int, bigint, smallint, and tinyint
Exact number data types that use integer data.

bigint

Integer (whole number) data from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807). Storage size is 8 bytes.

int

Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is integer.

smallint

Integer data from -2^15 (-32,768) through 2^15 - 1 (32,767). Storage size is 2 bytes.

tinyint

Integer data from 0 through 255. Storage size is 1 byte.

0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7116894
One more thing. While using all numeric data-types i have always skiped the size parameter of parameter object and never seem to have any problems. Size problem is significant only in case of char type of data. But i could be wrong. However, it is worth trying by omitting the size parameter.
0
 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7117991
Thanks guys,
Dear Nitin,
 i am using SQL server 7.0 and not sure whether the same[data type size] is applicable to it.

I tried setting numeric scale and precision properties as adviced by hongjun it works.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7118007
>>as adviced by hongjun it works.
So your problem solved?

hongjun
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question