Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all the varchar() fields in sql server?

Tags:

sql-server

Is it possible to find all the varchar() columns in my database?

I am using SQL Server 2008 and would like to get the list in SQL server management console.

JD.

like image 595
JD. Avatar asked Apr 27 '10 16:04

JD.


People also ask

How do I get a list of all columns in SQL?

To get the column name of a table we use sp_help with the name of the object or table name. sp_columns returns all the column names of the object. The following query will return the table's column names: sp_columns @table_name = 'News'


1 Answers

Yep, this should work:

select * from INFORMATION_SCHEMA.COLUMNS
where DATA_TYPE = 'varchar'
like image 179
Blorgbeard Avatar answered Oct 05 '22 09:10

Blorgbeard