Linked server query with column aliases captured with Profiler - just curious

  • All,

    I have a linked server on Server_A pointing to Server_B.

    On Server_A I executed SELECT top 5 * from Server_B.MyDB.dbo.table1

    and saw the follow captured in the Profiler I had running on Server_B:

    exec sp_prepexec @p1 output,NULL,N'SELECT TOP (5) "Tbl1002"."HdrHID" "Col1005","Tbl1002"."HdrTypeTID" "Col1006","Tbl1002"."HdrCode" "Col1007","Tbl1002"."HdrName" "Col1008","Tbl1002"."HdrAlpha" "Col1009" FROM "MyDB"."dbo"."table1" "Tbl1002"'

    I have done a lot of looking to find out what the valuese that appear as aliases ("Tbl1002", "Col1005", etc) represent. Can someone point me to where I can find the answer?

    Thanks in advance.

  • They're just aliases.

    What else did you want to know?

    -- Gianluca Sartori

  • Unfortunately I'm not an independent consultant. It is my manager who wants to know.

    I aready told him those quoted values represent aliases, most like some kind of metadata need by the linked server but since the originating query looks nothing like what Profiler captured he isn't satisifed my answer and wants citations.

    If you are aware of an MS link and willing share that would be great.

  • It's the way SQL Server treats remote queries with sp_prepexec.

    The query you're executing is translated into a pass-through query to the linked server.

    I can't find any documentation, though.

    Google "sp_prepexec" "pass-through" "linked server" and something should come up.

    -- Gianluca Sartori

  • Thanks. I'll check those in Google.

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

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