[dba-SQLServer] strip all leading / trailing spaces

David Lewis DavidL at sierranevada.com
Thu Dec 7 12:03:56 CST 2006




For sql2K, your query might looks something like:

SELECT o.name Table_Name
	, c.name Column_Name
	, t.name DataType
	, c.Length
	, CASE WHEN c.isnullable=1 THEN   'Yes'   	
		ELSE   'No'   END 
	AS 'Nullable' 
FROM sysobjects o
INNER JOIN syscolumns c ON (o.id=c.id and o.type='U')
INNER JOIN systypes t ON (c.xtype=t.xtype) 
ORDER BY o.name, c.name


This will give a list of all user tables in the db, with all columns,
datatypes, lengths, and if nullable.  

In the master database there are many stored procedures that can also
help you.  For this particular problem sp_MSHelpColumns is likely the
place to start (and isn't much different from the query above).  HTH.
D. Lewis



More information about the dba-SQLServer mailing list