Results 1 to 7 of 7
  1. #1
    scorpion99 is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Nov 2013
    Posts
    27

    convert nvarchar to number

    Hi all,

    I have a table in access linked to SQL.I am doing a query where I am using a field named comment from this table.
    The field is designed in SQL as nvarchar(255) . I am writing integers numbers in this field. What I want to do in my query is to convert this field from nvarchar to int so I can use the SUM function.Can anyone help?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Did you try the Int() function?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    sharondavis is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    1
    yup, as i have learned, int() will work.. you should try.
    free bonus casino

    Last edited by sharondavis; 09-25-2014 at 10:26 PM.

  4. #4
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    look up sql ALTER TABLE

    works if your col you want to change is empty

    else u'd have to add a col, update it from the char col and then remove the char col

    you can't do this from access though..

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    I believe the correct function is CInt()

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    Both work. CInt() will round decimal portion. Int() just drops the decimal portion.

    Both will error if the value contains alpha or empty string. CInt() also errors on Null.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    scorpion99 is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Nov 2013
    Posts
    27
    Thanks , it solved the issue

Please reply to this thread with any new information or opinions.

Similar Threads

  1. convert number to text number like in cheque
    By ravideep in forum Reports
    Replies: 1
    Last Post: 03-12-2013, 05:55 AM
  2. Replies: 0
    Last Post: 10-22-2012, 02:45 PM
  3. Convert Text to Number
    By Jerseynjphillypa in forum Import/Export Data
    Replies: 7
    Last Post: 05-09-2012, 12:45 PM
  4. Replies: 2
    Last Post: 11-22-2011, 11:45 AM
  5. Number convert to date
    By Argus in forum Programming
    Replies: 1
    Last Post: 08-05-2009, 02:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums