Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 VIEW_DEFINITION Field in INFORMATION_SCHEMA.VIEWS?

Author  Topic 

sandeep43
Starting Member

11 Posts

Posted - 2011-08-12 : 09:14:50
hi

select * from INFORMATION_SCHEMA.VIEWS

in this VIEW_DEFINITION field shows only part of sql string if the length is more, but i want entire sql string to be displayed. Please help me out

Regards
Sandeep

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-08-12 : 09:20:55
Are you viewing from SQL Server or some other place? I know that when I use information_schema from one of the sql-lite type of sql writers, it truncates some of the columns. YOu might want to try to wrap the View_Definition column in convert(varchar(max), view_definition):

select convert(varchar(max), view_definition) as 'Definition', ...other columns
From Information_Schema.Views

This works for me in the "SQL-Lite" type product that I use sometimes
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-08-12 : 09:33:22
You can also use the OBJECT_DEFINITION function in SQL 2005 or higher:

SELECT OBJECT_DEFINITION(object_id) FROM sys.views WHERE name='viewName'

edit: there's also sp_helptext:

exec sp_helptext 'viewName'
Go to Top of Page
   

- Advertisement -