Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    String into Numeric please (MS XP)

    I wasn't sure where to go. sorry if it is out of place.
    I need to link 2 tables. One is the view where field that matches THE Table was extracted like a function.
    So field was [NAMEOFTHEFIELD]=12345
    I had extracted 12345 and now I have a table where there is a field 12345 and i need to link by this field.
    However my Real table has this 12345 as Numeric and my view has it as String.

    Is there way I write this with conversion into Numeric:

    RIGHT(t.col, CHARINDEX('=', REVERSE(t.col)) - 1) AS CUS_ID

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: String into Numeric please (MS XP)

    Is this about Access? "MS XP" is rather vague.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String into Numeric please (MS XP)

    It is SQL Server query.
    None of the suggested working so far.
    Thanks

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: String into Numeric please (MS XP)

    Can you use CDbl(variable) or whatever Type Conversion function you need, and test the conversion with ISNUMERIC(return)?

    A list of Type Conversion functions is in the VBA Help:

    CBool(expression)
    CByte(expression)
    CCur(expression)
    CDate(expression)
    CDbl(expression)
    CDec(expression)
    CInt(expression)
    CLng(expression)
    CSng(expression)
    CStr(expression)
    CVar(expression)
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: String into Numeric please (MS XP)

    Then your question may belong in the Access Forum., not the VBA Forum. You will need to provide more information than in your original Post.
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: String into Numeric please (MS XP)

    I'm moving this to the Access forum. Next time, please indicate which program you're using in the subject of the post.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: String into Numeric please (MS XP)

    Try

    CAST(RIGHT(t.col, CHARINDEX('=', REVERSE(t.col)) - 1) AS Int) AS ... (CUS_ID ???)

    or

    CONVERT(int, RIGHT(t.col, CHARINDEX('=', REVERSE(t.col)) - 1)) AS ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •