Is there a way to get the statement that created a view for an existing view in SQL Server 2008? I thought there was a stored procedure or some metadata that had this data, but I'm not finding anything.
Views can be created from a single table, multiple tables or another view.
Using views to reference other views is perfectly acceptable. The performance will greatly depend on your code, though.
You can get a list of the schemas using an SSMS or T-SQL query. To do this in SSMS, you would connect to the SQL instance, expand the SQL database and view the schemas under the security folder. Alternatively, you could use the sys. schemas to get a list of database schemas and their respective owners.
Right click on the view and script it.
Have you had a look at sp_helptext?
sp_helptext 'dbo.name_of_view'
SQL SERVER – Stored Procedure to display code (text) of Stored Procedure, Trigger, View or Object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With