Syntax for sp_help command
exec sp_helpCreating a view from a select query
CREATE VIEW QueryResults AS SELECT * FROM SomeTableRun sp_help to find details of return types
exec sp_help QueryResultsYou can do all 3 steps in one go, but you will need the go command after creating a view
-- create view with select query CREATE VIEW QueryResult AS SELECT TOP 1 * FROM Items GO -- get details of result like type info exec sp_help QueryResult -- drop view since we are done with it DROP VIEW QueryResultIn sql server management studio the output will look something like this:
No comments:
Post a Comment