How to change the datatype in a query?


  1. Posts : 5
    Windows XP
       #1

    How to change the datatype in a query?


    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 by Aisha00; 13 Apr 2010 at 17:38.
      My Computer


  2. Posts : 1,506
    W7 Ult. x64 | OS X
       #2

    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


  3. Posts : 5
    Windows XP
    Thread Starter
       #3

    notsograymatter said:
    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


  4. Posts : 5,056
    Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86
       #4

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

    Access: Round Function
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 06:43.
Find Us