How to see the source SELECT statement of views?

  • imani_technology

    SSCrazy Eights

    Points: 8174

    I don't have permissions to right click\design views or to script the views.  Is there another way to see the source SELECT statement?  I don't see anything under the INFORMATION_SCHEMA.VIEWS.

  • ScottPletcher

    SSC Guru

    Points: 98401

    If you don't have permission, you won't have permission period, but the command-line way to get the text is:

    EXEC sys.sp_helptext 'view_name'

     

    SQL DBA,SQL Server MVP(07, 08, 09) Prosecutor James Blackburn, in closing argument in the Fatal Vision murders trial: "If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them."

  • imani_technology

    SSCrazy Eights

    Points: 8174

    Thank you.  I tried out the EXEC statement and received an error.  I'm guessing it's because I don't have adequate permissions, like you said.

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 718065

    Likely you don't have permission. The best way is just to ask someone. They might not give you permissions, but I'd hope they would send you the definition.

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

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