Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Currency data type

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-03-22 : 12:49:58
Hey

I need to create a currency column with a format value of £0.00

whats the best way to do this?

Create table Fees
(
FeeID int not null primary key,
BandName varchar(40),
Fee int smallmoney,
foreign key (BandID) references Bands (BandID)

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-03-22 : 13:19:52
You'd need to create a string-type column in order to store a formatted string. Formatting should be done in the front-end, so the best way is to NOT do that.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-22 : 13:27:51
What, you want to know that the money is in Pounds?

If so, that's irrelavant, unless you keep another type column that describes what TYPE of money it is.

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-03-22 : 13:31:29
Ok take your point so just raw values in backend, is money type still ok to store though or should that be decimal or int?
Ta
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-22 : 13:34:04
money is a decimal datatype already

http://msdn.microsoft.com/en-us/library/ms179882.aspx



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-03-22 : 13:44:35
Ok thanks money it is.
Go to Top of Page
   

- Advertisement -