Wednesday, October 15, 2008

Small Thing Learned Today

In SQL Server 2005, if I need to know what are the columns and data types of the certain table, I can run a simple query to know it:

select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='MyTable'

What's especially good for me is that it not only works with tables, but with views too. My current task is to create an interface for users which would allow them to generate custom reports through a set of views. They need to be able to apply criteria to the reports so that if the column's data type is datetime, they can use 'Is Before' or 'Is After', but on integer columns they can use 'Larger Than' etc.

by . Also posted on my website

No comments: