Retrieving looked up values when writing data from ms access to sql server

  • Hello All,

    I have a table which looks up values from another table based on a referencing ID. When I try to write this table into sql server, I get the reference IDs instead of the value. Is there any way retrieve the values that is originally looked up?

    Regards,

    Mathews

  • doesnt sound too complicated, but with out seeing your code difficult to say.

    are you using an inner join between the tables based on the reference ID?

    if you want a tried and tested answer, please read this https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/ and post back accordingly

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • The following code has two purposes.

    1. It demonstrates an example on how to post code so that we can help you. (Please read previously provided link for more info)

    2. It gives you an example of how to pull a value from on table based on an ID from another.

    If you would like help more specific to your problem please post your own code.

    Welcome to the forums,

    Cheers

    DECLARE @table1 TABLE (ID INT)

    DECLARE @table2 TABLE (ID INT, myValues VARCHAR(20))

    INSERT INTO @table1

    VALUES (1), (2), (3)

    INSERT INTO @table2

    VALUES (1, 'value1'), (2, 'value2'), (3, 'value3')

    SELECT

    t1.ID,

    t2.myValues

    FROM @table1 t1

    JOIN @table2 t2 ON t2.ID = t1.ID


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • Lookups are going to bite you. Remove them all, then move to SQL Server. They don't exist in SQL Server, and didn't exist in Access for a long time. Here's an article from an Access website that used to be great... before Dev moved on to other things.

  • Thank you all for your replies!

    I have attached snap shots of the steps that I am trying to carry out.

    In 1, shows a table with a column labelled "Information" that contains values looked up from a User Info table

    2, shows the lookup logic definition

    3, shows the way the same table with a column labelled "Information" values are stored in SQL server when importing table from MS access to SQL server (int6 is the header for "Information" column in SQL server)

    The "Information" column is just one of the many columns that I have to import to SQL server so replicating the join logic for each columns is not feasible at the moment. Is there any other way to store these looked up values in Ms Access so that when I write this data back I can see the labels instead of the ids?

    Regards,

    Mathews

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply