code_junkie

System Views text in SQL Server 2005

Nov 13th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. exec sys.sp_helptext ObjectName
  2.  
  3. select text from syscomments where id =
  4. OBJECT_id('objectname')
  5. order by colid
  6.  
  7. -- This generates view definitions
  8. --
  9. select definition + char(10) + 'go' + char(10)
  10. from sys.sql_modules c
  11. join sys.objects o
  12. on c.object_id = o.object_id
  13. join #views o2
  14. on o.object_id = o2.object_id
  15.  
  16. select o.name
  17. ,o.object_id
  18. into #views
  19. from sys.objects o
  20. join sys.schemas s
  21. on s.schema_id = o.schema_id
  22. where o.type in ('V')
  23. and s.name = @schema
  24.  
  25. SELECT * FROM sysobjects
  26. WHERE name LIKE 'dm_%'
  27. order by name
  28.  
  29. exec sp_helptext N'sys.dm_os_sys_info'
  30.  
  31. CREATE VIEW sys.dm_os_sys_info AS
  32. SELECT *
  33. FROM OpenRowset(TABLE SYSINFO)
Add Comment
Please, Sign In to add comment