Solved

ASP datatype for SQL server Numeric [Command object]

Posted on 2002-06-28
5
537 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
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 200 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 6

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 6

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now