?? on adding records to a table ??

  • Hi,

    Not sure how to set this up?

    INSERT INTO PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    OID_LINK = '003A19E3D3B040958EFA16EB2585B0DC', OID=oid

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    FROM dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION where OID = '002771F071C541F4B5478D246381E7E7'

    I want add '003A19E3D3B040958EFA16EB2585B0DC' oid_link for every oid?

    Thanks in Advance

    Joe

  • jbalbo (11/20/2012)


    Hi,

    Not sure how to set this up?

    INSERT INTO PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    OID_LINK = '003A19E3D3B040958EFA16EB2585B0DC', OID=oid

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    FROM dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION where OID = '002771F071C541F4B5478D246381E7E7'

    I want add '003A19E3D3B040958EFA16EB2585B0DC' oid_link for every oid?

    Thanks in Advance

    Joe

    Your syntax is nowhere close here. You have to specify the columns on an insert. I am pretty sure you want something like this:

    INSERT INTO PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    (OID_LINK, OID)

    SELECT '003A19E3D3B040958EFA16EB2585B0DC', PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID

    FROM dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION

    where OID = '002771F071C541F4B5478D246381E7E7'

    _______________________________________________________________

    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/

  • thanks for the quick reponse..

    so I have to setup a bunch of selects for each OID in the tabe?

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    FROM dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION where OID = '002771F071C541F4B5478D246381E7E7'

    SELECT PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID, PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION.OID_LINK

    FROM dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION where OID = '002771F071C541F4B5478D246381E7E8' etc...

    thanks

    Again

  • To be honest, there really isn't enough information in your post to provide a decent answer. Could you provide us with a clearer explaination of what it is you are trying to accomplish?

  • Edited after re-reading..

    I'm actually not sure what you're looking for either. You appear to be attempting to insert values from a table back into the same table. Some clarification would be useful.

  • Thanks for the response, not sure if its the best way , but came up with this using excel:

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES('002771F071C541F4B5478D246381E7E7','CB30DF919B0F468AB203FFD848D11463');

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES('003A19E3D3B040958EFA16EB2585B0DC','CB30DF919B0F468AB203FFD848D11463');

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES('00CD83EC6F9E4CCDAA22D8D7C6B8C59E','CB30DF919B0F468AB203FFD848D11463');

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK) VALUES('00DE552BB51A490B91E87E6E1236CBD8','CB30DF919B0F468AB203FFD848D11463');

  • That would work. Just a FYI, something like this would also work:

    INSERT INTO dbo.PROVIDER_TO_TRUSTED_PROVIDER_COLLECTION (OID, OID_LINK)

    VALUES

    ('002771F071C541F4B5478D246381E7E7','CB30DF919B0F468AB203FFD848D11463')

    ,('003A19E3D3B040958EFA16EB2585B0DC','CB30DF919B0F468AB203FFD848D11463')

    ,('00CD83EC6F9E4CCDAA22D8D7C6B8C59E','CB30DF919B0F468AB203FFD848D11463')

    ,('00DE552BB51A490B91E87E6E1236CBD8','CB30DF919B0F468AB203FFD848D11463')

Viewing 7 posts - 1 through 6 (of 6 total)

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