Help on update ??

  • Hi

    I'm trying to setup a job to run weekly that would add/update each PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    to 3 specific oids

    The end goal because I have a hard time explaining things...

    is that every provider should have 3 specific trusted providers

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK, Provider.LName

    FROM dbo.Provider AS Provider INNER JOIN

    dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION AS PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION ON

    Provider.OID = PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID

    example

    Provider.OID-----PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    12--------------001

    12--------------002

    12--------------003

    13--------------001

    13--------------002

    13--------------003

    Thanks IN advance

    Joe

  • jbalbo (10/15/2013)


    Hi

    I'm trying to setup a job to run weekly that would add/update each PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    to 3 specific oids

    The end goal because I have a hard time explaining things...

    is that every provider should have 3 specific trusted providers

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK, Provider.LName

    FROM dbo.Provider AS Provider INNER JOIN

    dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION AS PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION ON

    Provider.OID = PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID

    example

    Provider.OID-----PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    12--------------001

    12--------------002

    12--------------003

    13--------------001

    13--------------002

    13--------------003

    Thanks IN advance

    Joe

    Going to need some details to work with here. We have no idea what you are trying to do and have no idea what your tables are like.

    In order to help we will need a few things:

    1. Sample DDL in the form of CREATE TABLE statements

    2. Sample data in the form of INSERT INTO statements

    3. Expected results based on the sample data

    Please take a few minutes and read the first article in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sorry

    I have a provider table each with a unique OID

    I want to do the following INSERT on each provider

    Some will have them already but it willl just send the message..... Cannot insert duplicate key in .....

    Select * from Provider

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'8941B194194F4D40BE25AA775D3B70AA')

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'44444555194F4D40BE25AA775D3B70AA')

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'8484584848444D40BE25AA775D3B70AA')

    SO when the job is complete each provider has at least the 3 records above on dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    Example provider John Smith has oid 123 on dbo.PROVIDER

    I need to Add 3 records to dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION each having this dbo.PROVIDER.OID in the OID field and each having one of the values above in the OID_LINK field..

    I hope this makes more sense

    Thanks

  • jbalbo (10/15/2013)


    Sorry

    I have a provider table each with a unique OID

    I want to do the following INSERT on each provider

    Some will have them already but it willl just send the message..... Cannot insert duplicate key in .....

    Select * from Provider

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'8941B194194F4D40BE25AA775D3B70AA')

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'44444555194F4D40BE25AA775D3B70AA')

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES(Provider.OID,'8484584848444D40BE25AA775D3B70AA')

    SO when the job is complete each provider has at least the 3 records above on dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    Example provider John Smith has oid 123 on dbo.PROVIDER

    I need to Add 3 records to dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION each having this dbo.PROVIDER.OID in the OID field and each having one of the values above in the OID_LINK field..

    I hope this makes more sense

    Thanks

    There is nothing like ddl, sample data and expected output to help clarify requests like this, and what you posted is nothing like ddl, sample data and expected output.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

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

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