Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to translate Numeric Size to TEXT BOX MAX LENGTH

Status
Not open for further replies.

nomi2000

ISP
Joined
Feb 15, 2001
Messages
676
Location
CA
Hi guys
I m using Using SQL Server 200 with VB .Net
I have some numeric fields like
Rate numeric(12,2)
now how i translate this size to the MAX Length of say textbox so user wont be able to type above maxmimum limit
how i can find the Maxmimum No allowed for the above Field?
For varchar fields i don't have any probs but for numeric fields i want to know a proper way to figuring out the max length
Regards
Nouman

Nouman Zaheer
Software Engineer
MSR
 
YOu would not normally validate data for a numeric based stricly on length but on the value entered. Numeric 12, 2 has 12 significant digits, two of which are to the right of the decimal point. That should tell you mathmatically the highest number that can be entered is 9999999999.99 and lowest is -9999999999.99. So you would design your validation to see if the value entered is a number between (and including) those two values. You might also want to test the number of decimal places and give the user a warning that the data will be truncated if they put type a value like 34.123.

 
Thanks SQL Bill
so what about other variable type like
DECIMAL,INT or float is there any chart which can tell me what the maxmimum and minimim values allowed for a particular data type
Regards
Nouman


Nouman Zaheer
Software Engineer
MSR
 
I'm not Bill, but if you look under data types in Books online and select the description of the data type you are interested in, it will tell you the value range the data type can accept.
 
where can i find this 'Books On-line'? Im interested in reading more about data types... specifically, im trying to get a field to hold a paragraph or 3 of text... ive tried a 'TEXT' field with max length of '8000' but it cuts it off after like 250 characters.... i think i tried NVARCHAR as well with the same results...

any suggestions?

thank you!

michael wolff
New at SQL
 
Please see my comments in your original post:
thread183-704873

--James
 
Book on line is the SQL help file. THe simplest way to get to it is to click the Help Icon in ENterprise Manager.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top