Is there a way to retrieve the view definition from a SQL Server using plain ADO?

前端 未结 6 645
攒了一身酷
攒了一身酷 2020-12-02 08:00

I\'m successfully extracting column definitions from databases hosted on a SQL server using the ADO Connection OpenSchema() call in its various incarnations so

6条回答
  •  孤城傲影
    2020-12-02 08:51

    Microsoft listed the following methods for getting the a View definition: http://technet.microsoft.com/en-us/library/ms175067.aspx


    USE AdventureWorks2012;
    GO
    SELECT definition, uses_ansi_nulls, uses_quoted_identifier, is_schema_bound
    FROM sys.sql_modules
    WHERE object_id = OBJECT_ID('HumanResources.vEmployee'); 
    GO
    

    USE AdventureWorks2012; 
    GO
    SELECT OBJECT_DEFINITION (OBJECT_ID('HumanResources.vEmployee')) 
    AS ObjectDefinition; 
    GO
    

    EXEC sp_helptext 'HumanResources.vEmployee';
    

提交回复
热议问题