﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 General Discussion  / How can I Select a View's Creation SQLfrom Information_Schema? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 17:53:18 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How can I Select a View's Creation SQLfrom Information_Schema?</title><link>http://www.sqlservercentral.com/Forums/Topic486990-149-1.aspx</link><description>In SQL 2005, there's a view called "sys.sql_modules", which has the definition (create script) for views, procs, etc.  Books Online has the specifics.Join that to sys.views to get the name (or to sys.all_objects) on object_id column.If you can select from that, you should get what you need.Edit: I just tested this with a proc with just over 75,000 characters, and it returned as a single row with the full text in it.</description><pubDate>Fri, 18 Apr 2008 07:53:22 GMT</pubDate><dc:creator>GSquared</dc:creator></item><item><title>RE: How can I Select a View's Creation SQLfrom Information_Schema?</title><link>http://www.sqlservercentral.com/Forums/Topic486990-149-1.aspx</link><description>sp_helptext should give you what you're looking for.  But you may have to grant your user higher permissions than it already has - check out the Permissions section of the sp_helptext topic in Books Online.John</description><pubDate>Fri, 18 Apr 2008 04:26:24 GMT</pubDate><dc:creator>John Mitchell-245523</dc:creator></item><item><title>RE: How can I Select a View's Creation SQLfrom Information_Schema?</title><link>http://www.sqlservercentral.com/Forums/Topic486990-149-1.aspx</link><description>Thanx a lot for the anwer I am aware of this,I need to be able to do this dynamically from the .NET applicationnot manually from the Enterprise manager.It is part of an automated procedure, and the View name and other parameters (Like the Database and Server name)  are supplied run-time...:D</description><pubDate>Fri, 18 Apr 2008 04:20:24 GMT</pubDate><dc:creator>John.Geranios</dc:creator></item><item><title>RE: How can I Select a View's Creation SQLfrom Information_Schema?</title><link>http://www.sqlservercentral.com/Forums/Topic486990-149-1.aspx</link><description>In the Object Explorer for the SQL Server, expand the database, expand views, find the view, right click and Script view as &amp;gt; Create To &amp;gt; New Query &amp;#119;indow.</description><pubDate>Fri, 18 Apr 2008 04:11:54 GMT</pubDate><dc:creator>Akeel.Mughal</dc:creator></item><item><title>How can I Select a View's Creation SQLfrom Information_Schema?</title><link>http://www.sqlservercentral.com/Forums/Topic486990-149-1.aspx</link><description>HelloI am writing an application in VB .net.I need to perform select queries using the SQL of pre existing Views in the server, after some slight "surgery" on it. ( So I cannot just write SELECT* from View_A and be good with it.)I need to be able to retrieve the SQL of a view, by just providing its name as a parameter.I have found the solution:SELECT      TABLE_NAME, VIEW_DEFINITIONFROM         INFORMATION_SCHEMA.VIEWSWHERE     (TABLE_NAME = 'Report_View_A')It is what I want but....Some views are very complex thus long...(have a large SQL script)So in this cases i get a "Trimmed" VIEW_DEFINITION as return...How can i get the full View definition SQL?Where does SQL Server keeps the full SQL of the views?Could you please help?....Thanx in advance..A.I.G:)</description><pubDate>Fri, 18 Apr 2008 03:08:30 GMT</pubDate><dc:creator>John.Geranios</dc:creator></item></channel></rss>