473,508 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert 1223/100 to 12.23 not 12 in sql server?

I have a column called "Amount" and this field contains amount as cents.
So when I get the values of it, I do like "select amount / 100 as
amount" which basically ignores cents. Do you know how to get cents?

Thanks a lot

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
2 1335

TaeHo Yoo wrote:
I have a column called "Amount" and this field contains amount as cents.
So when I get the values of it, I do like "select amount / 100 as
amount" which basically ignores cents. Do you know how to get cents?

Thanks a lot

*** Sent via Developersdex http://www.developersdex.com ***


Hi YaeHo

You can use convert here i think. eg... (in query analyser )

drop table foo
create table foo
(
amount int not null
)
go
insert foo( amount ) values( 94)
go
insert foo( amount ) values (10)
go
select convert( float , amount )/ 10 from foo

Nov 17 '05 #2
select cast(amount as money) / cast(100 as money) as amount

"TaeHo Yoo" wrote:
I have a column called "Amount" and this field contains amount as cents.
So when I get the values of it, I do like "select amount / 100 as
amount" which basically ignores cents. Do you know how to get cents?

Thanks a lot

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4375
by: Ming-Chi | last post by:
Dear All We have been troubling by this for some time. Server is based on RedHat 8 Linux. DB2 is on V7.2 with Fixpak 10a. Here is DBM Configuration Max number of existing agents ...
4
3337
by: Guy | last post by:
I got a big Access file (1 400 tables) to convert to SQL and I would like to be provided with some automated tools, except upsizing wizard and DTS, to convert it on my own. I got a lot of forms...
25
4342
by: cory | last post by:
Hi, I have an Access database and am having an ASP.NEt application written for it. It is almost complete. I have a hosting company that I signed up with a month ago but before I did anything I...
2
5620
by: VenuGopal | last post by:
Hi Everyone, in my application i am interacting to a known server. i send a request and get a response from the server. i am using XML and HTTP here. part of the job is that the XYZ server is...
5
2707
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
2
4209
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
4
118780
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
6
2985
by: tshad | last post by:
Apparently, I can't do: Dim da2 As New OleDb.OleDbDataAdapter("Select PR, Convert(varchar,getchar(),1),F1, F2, F5, Sum(F4) from temp .... I am getting this error. 'undefined function...
1
3568
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.