February 10, 2006 at 3:48 pm
I have a view which contains 100+ columns from 8 various tables.
I need to list all 100+ columns with their data types because I am looking for fields with ntext data types that will require a cast.
I can view this list in SQL Query Analyzer by clicking on that view name and expanding the columns.
But since I have several views that will have to go through the same type of screening, I'd like to find out if there is a script that will list columns with their datatypes given the viewname.
Thanks
February 10, 2006 at 4:02 pm
You could run this in Query Analyzer. That gives you the option of making a CSV or Excel or just viewing in the results pane.
use database_name
go
sp_help view_name
Michelle
February 10, 2006 at 4:35 pm
Thank you, Michelle. That works fine.
February 13, 2006 at 10:57 am
you might also want to look at some of the built in views;INFORMATION_SCHEMA has a lot of nice data.
in my database, all my views start with VW_; change your WHERE statement accordingly:
SELECT * FROM INFORMATION_SCHEMA.COLUMNS where table_name like 'VW_%'
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply