MySQL:
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v';
reference:INFORMATION_SCHEMA VIEWS-tabellen
SQL-server:
USE databasename
GO
EXEC sp_helptext viewName
eller også en forespørgsel som denne:
SELECT TABLE_NAME as ViewName,
VIEW_DEFINITION as ViewDefinition
FROM INFORMATION_SCHEMA.Views
hvor du kan tilføje en WHERE
for kun at hente én visning