Davood
Davood

Reputation: 5645

what is smallmoney data type unit in sql server?

smallmoney data type in sql server makes me confuse.

after creating a table and add a columns with this data type, i entered a number(one) and it shows me this:

 1.0000

what is this means?this means is one dollar or one cent? if i want to store one cent i should enter what?

 this 0.1 or 1.0000 and if is correct what about entering one dollar?

i want to store some things like this one dollar and 55 cent.

Upvotes: 0

Views: 2941

Answers (2)

CDspace
CDspace

Reputation: 2689

smallmoney is just like money, but smaller. Specifically money is an 8 bit Decimal, whereas smallmoney is a 4 bit Decimal. Source

Further, your question on what does 1.000 represent, it can represent what you want. Again from the source

Use a period to separate partial monetary units, like cents, from whole monetary units. For example, 2.15 specifies 2 dollars and 15 cents.

Presumably you could consider 2.15 to mean 2.15 million, just deal with it appropriately when you handle the data

Upvotes: 1

Tim Schmelter
Tim Schmelter

Reputation: 460228

smallmoney is decimal.

Have a look at MSDN

SQL-Server-type    .NET-type    SqlDbType     SqlDataReader 
smallmoney         Decimal      SmallMoney    GetSqlMoney     

Upvotes: 0

Related Questions