How To Get a List of Columns in a View using the "sp_help" Stored Procedure?
Submitted by: AdministratorAnother way to get a list of columns from a view is to use the "sp_help" stored procedure. "sp_help" returns more than just a list of columns. It returns: the view information, the column information, the identity column, the row GUID column. The tutorial exercise belwo shows you what you will get with sp_help:
EXEC SP_HELP ggl_links_top;
GO
<pre>Name Owner Type Created_datetime
-------------- ------ ----- -----------------------
ggl_links_top dbo view 2007-05-19 13:43:46.983
Column_name Type Computed Length Prec Scale Nullable
------------ -------- --------- ------- ----- ----- --------
id int no 4 10 0 yes
counts int no 4 10 0 yes
url varchar no 80 no
Identity
---------------------------
No identity column defined.
RowGuidCol
-----------------------------
No rowguidcol column defined.</pre>
Submitted by: Administrator
EXEC SP_HELP ggl_links_top;
GO
<pre>Name Owner Type Created_datetime
-------------- ------ ----- -----------------------
ggl_links_top dbo view 2007-05-19 13:43:46.983
Column_name Type Computed Length Prec Scale Nullable
------------ -------- --------- ------- ----- ----- --------
id int no 4 10 0 yes
counts int no 4 10 0 yes
url varchar no 80 no
Identity
---------------------------
No identity column defined.
RowGuidCol
-----------------------------
No rowguidcol column defined.</pre>
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If NULL Values Are Involved in Arithmetic Operations? |
☺ | How To Use Subqueries with the EXISTS Operators in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Use Subqueries in the FROM Clause in MS SQL Server? |
☺ | How To Get the Definition of a View Out of the SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |