How to change the datatype in a query?

Aisha00

New member
Local time
3:48 PM
Messages
5
Hello everyone, I was doing an assignment in which i created a query and performed a calculation in it; the answer of the calculation should be as an integer whereas the answer i got is suppose "6.7779999", if i'm not wrong the only way to change my answer to an integer is by changing the data type, and i spend about half an hour trying to find a way to do so but in vain, so i was wondering if anyone here could please help me out. Thankyou
:)

P.s- I've been using office for quite some time now but the sql thing is pretty new to me, so if anybody suggests making any changes to it, can you tell me how exactly to do it aswell please? and bt the SQL view for my query is provided at the end and i wanna change the data type of hours worked to integer ..... SELECT DISTINCT Technician.[Technician Number], Technician.[Last Name], Technician.[First Name], Technician.[Hourly Rate], Technician.[YTD Earnings]/[Hourly Rate] AS [Hours Worked]
FROM Technician
GROUP BY Technician.[Technician Number], Technician.[Last Name], Technician.[First Name], Technician.[Hourly Rate], Technician.[YTD Earnings]/[Hourly Rate]
ORDER BY Technician.[Last Name];
 
Last edited:

My Computer My Computer

At a glance

Windows XP
OS
Windows XP
Not sure if this is what you're looking for:

I have a field CMS_STDY_PRD

In my query I want to
1) change the data type to character
and
2) give the field an Alias of Study_Period.

How do I change the data type in a qry?
Is it possible to change the data type and the field name in the same step?

JZ

RESPONSE

If you mean you only want the change to happen in the query results and not
have any effect on the actual data stored the table.

Field: Study_Period: CMS_STDY_PRD & ""

In an SQL statement that is

SELECT CMS_STDY_PRD & "" as Study_Period, ...
 

My Computer My Computer

At a glance

W7 Ult. x64 | OS XIntel Mobile Core 2 Duo 2.93Ghz [T9800 Penryn]4096MB Samsung DDR3 Dual Channel [PC3-8500F 1...NVIDIA GeForce 9600M GT 512MB [G96M Rev. C1]
Computer Manufacturer/Model Number
Apple Macbook Pro (April 2009)
OS
W7 Ult. x64 | OS X
CPU
Intel Mobile Core 2 Duo 2.93Ghz [T9800 Penryn]
Motherboard
NVIDIA nForce 730i Rev. B1 [Mac-F2268EC8 (U2E1)]
Memory
4096MB Samsung DDR3 Dual Channel [PC3-8500F 1066Mhz]
Graphics Card(s)
NVIDIA GeForce 9600M GT 512MB [G96M Rev. C1]
Sound Card
SB X-Fi Surround 5.1 USB | Onboard Realtek (Disabled)
Monitor(s) Displays
Acer x223wbd 22" | Apple Anti-Glare 17" (Disabled)
Screen Resolution
{Current} 1440x900 {Acer} 1680x1050 {Apple} 1920x1200
Hard Drives
{Internal}
Seagate Momentus 320GB 2.5" 7200RPM [ST9320421AS]

{Externals}
LaCie 320GB USB 2.0 HDD [301284UR]
LaCie 750GB USB 2.0 FW400 eSATA HDD [301314U]
LaCie 1TB USB 2.0 HDD [301304UR]
PSU
Magsafe
Case
Aluminum/Unibody (MBP52)
Cooling
2 x 6000 RPM Fans
Keyboard
Logitech G-15v2 [PN 920-000379]
Mouse
Logitech G-9 [PN 910-000338]
Internet Speed
12Mbps/2.5Mbps w/ 24Mbps Speed Boost [Comcast]
Other Info
Logitech X-540 Speakers [PN 970223-0122]
Sennheiser PC-151 Headset
Not sure if this is what you're looking for:

I have a field CMS_STDY_PRD

In my query I want to
1) change the data type to character
and
2) give the field an Alias of Study_Period.

How do I change the data type in a qry?
Is it possible to change the data type and the field name in the same step?

JZ

RESPONSE

If you mean you only want the change to happen in the query results and not
have any effect on the actual data stored the table.

Field: Study_Period: CMS_STDY_PRD & ""

In an SQL statement that is

SELECT CMS_STDY_PRD & "" as Study_Period, ...

Isn't that only for the alias?, i might be wrong...i'm sry, its just tht i'm kinda new to all this!
 

My Computer My Computer

At a glance

Windows XP
OS
Windows XP
In Access, you can use the ROUND function with the appropriate parameter to get your desired result. Read this.

Access: Round Function
 

My Computer My Computer

At a glance

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
Computer Manufacturer/Model Number
Too many to describe...
OS
Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
Back
Top