How is TableAlias in the MergeSpecification class in ScriptDom to be understood?

  • Hello, everyone

    am currently learning Microsoft.SqlServer.TransactSql.ScriptDom.

    Have already implemented a lot but now I have to ask you something.

    The following sql statement is to be parsed:

    MERGE [0150].[tbl_iTWO_HISTORY_KPL_KE_DOKUMENT] AS [Ziel]
    USING [0100].[tbl_iTWO_DELTA_KPL_KE_DOKUMENT] AS [Quelle]
    ON [Ziel].RIB_PRJ_ID = [Quelle].RIB_PRJ_ID
    WHEN MATCHED
    THEN UPDATE SET [Ziel].Active = 0;

    Here my Question:

    Why do I get a value back when I call:

    MergeStatement mergeStatement = sqlStatement as MergeStatement;
    Console.WriteLine("Taget-Table Alias=> [{0}] ", mergeStatement.MergeSpecification.TableAlias.Value);

    In the call below I don't get any result:

    TableReference tableSource =(mergeStatement.MergeSpecification.Target as TableReference);
    string alias = ((NamedTableReference)(tableSource)).Alias?.Value ?? "";

    Where is my mistake?

    viele Grüße

    Frank Kress

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • My dream residence could be very one of a kind from the usual house. i would love to introduce it to you if you are interested in it.

    the shape of my dream residence like a strawberry; the roof if inexperienced, and walls are crimson.

    let’s enter my dream house and look around: it consists of a dwelling-room, a observe-room, a bed room, and a bathroom. the wall of the bedroom is covered with mink, so that i'm able to sleep with a candy dream and sense extra at ease. there are lots of factors in my house ----which includes computers,televisions, telephones, tables, beds, and so on. of path, the cost of my dream residence may be very huge, too.

    how can make my dream come real? we can understand it most effective by our hard operatingn?

    eCommerce directories and sponsored links

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

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