Transient Synonyms

  • Comments posted to this topic are about the item Transient Synonyms

  • Interesting question to end the week on, thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • You also can create synonym without an existing object.

    In your example you mismatched the synonym StagingSongs with SongStaging

    CREATE SYNONYM SongStaging FOR #songs
    GO
    CREATE PROCEDURE dbo.LoadSongs
    AS
    INSERT Songs
    (
    songid,
    title,
    releasedate,
    genre
    )
    SELECT songid,
    title,
    releasedate,
    genre
    FROM dbo.StagingSongs
    WHERE title NOT IN (SELECT title FROM Songs)
    GO
  • I'm confused.  What data is added, given that the temp table #songs never had anything in it?

     

  • Carlo Romagnano wrote:

    In your example you mismatched the synonym StagingSongs with SongStaging

    That's what I thought as well. I think it works if you still have the synonym StagingSongs from a previous question of the day. 🙂

    Sue

  • Carlo Romagnano wrote:

    In your example you mismatched the synonym StagingSongs with SongStaging

    I noticed this as well, but since there was no option for "Invalid object name 'dbo.StagingSongs'.", I assumed the intention was for the synonym name to match the object name in the SELECT query.

  • #$%#$ apologies for the mismatched names

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

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