How to see the source SELECT statement of views?

  • 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.

  • 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) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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.

  • 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 3 (of 3 total)

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