Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi how to select decimal precision and scale value from table?


SQL
USE DBNAME SELECT column_name 'Column Name',data_type 'Data Type',CHARacter_maximum_length 'Maximum Length',data_decimal(p,s) 'DECIMAL PRECISION',COLUMNPROPERTY (OBJECT_ID(Table_Name),Column_Name,'IsIdentity') as FieldIdentity FROM information_schema.columns WHERE table_name = 'TBNAME' ;


with this if the data type is decimal i want that values also ..how to list .

eg:decimal(4,2)

how to select that precision and scale from table


[edit]Code blocks sorted out - OriginalGriff[/edit]
Posted
Updated 23-Jun-11 20:52pm
v3

1 solution

What is data_decimal(p,s)?

Check NUMERIC_PRECISION and NUMERIC_SCALE.
 
Share this answer
 
Comments
suryaswathi 24-Jun-11 4:04am    
Hi sir i got it the decimal value....now i am using this query

use regimen SET IDENTITY_INSERT data ON insert into data (firstname,lastname,quantity,rollno) values ('tiGzdrVVzyGzHGEOuRPBYwuFZpKaVYqQbSZYsEHyjRKt','PsqAmzUFTW','62313539.54','03615') SET IDENTITY_INSERT data OFF



to insert

but i got error

Arithmetic overflow error converting varchar to data type numeric.
The statement has been terminated.

what i mad mistake
can u say?
Prerak Patel 24-Jun-11 4:24am    
Just try removing single quotes from '62313539.54','03615'
I mean, use 62313539.54,03615 instead.
suryaswathi 24-Jun-11 4:37am    
i tried eventhough i got same error
Prerak Patel 24-Jun-11 4:49am    
What are datatypes for firstname,lastname,quantity,rollno?
suryaswathi 24-Jun-11 4:44am    
is any other way to do this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900