Results 1 to 2 of 2
  1. #1
    Mnelson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    7

    Question Transform Column values in Table

    Hello, I'm new to scripting so stick with me. I'm trying to create a script that will transform the column values in my Table. I'm currently using SQL Management Studio.




    Here's what I'm trying to do:

    I have a column with account numbers in this form:

    R12345
    M23456
    T12345

    R= 100 M=200 T= 300

    I'm trying to convert the first letter to a sequence of numbers then keep the remaining numbers. For example


    R12345 to 10012345
    M23456 to 20023456
    T12345 to 30012345


    I have thousands of this account numbers that I need to change. How would I do this in Access?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Do you actually want to change the data in the table or just for display purposes?

    How many letters are involved?

    What code lanquage does SQL Management Studio use?

    You can do this conversion by constructing a field in query with expression, like:

    Switch(Left(fieldname,1)="R",100, Left(fieldname,1)="M",200, Left(fieldname,1)="T",300,) & Mid(fieldname,2)
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-05-2011, 04:53 AM
  2. Replies: 3
    Last Post: 09-28-2011, 04:29 PM
  3. Replies: 3
    Last Post: 11-24-2010, 06:33 PM
  4. Replies: 1
    Last Post: 08-21-2009, 06:52 AM
  5. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05:23 AM

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