Virtual Tables

  • At my last job, we used to create virtual tables using code, we would select data from the table, when creating the table, we would referecne the table as vtt, does this sound familiar to anyone? I forgot how and I wanted to use it again.

    Richard

  • Hi Richard,

    Do you mean views???

    if so

    CREATE VIEW [< owner > . ] view_name [ ( column [ ,...n ] ) ]

    [ WITH < view_attribute > [ ,...n ] ]

    AS

    select_statement

    [ WITH CHECK OPTION ]

    < view_attribute > ::=

        { ENCRYPTION | SCHEMABINDING | VIEW_METADATA }

    check in Books Online for Create View


    Lucky

  • Did you mean derived table ?

    As in (using system tables for an example):

    Select TableName, NumberOfColumns

    From

    -- Parenthesis starts derived/virtual table definition

    (

      Select Object_Name(id) As TableName, Count(*) As NumberOfColumns

      From syscolumns

      Group By Object_Name(id)

    ) vtt --  <- arbitrary alias for derived/virtual table

  • I was talking about the derived table, thank you.

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

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