JDev

Code, SQL ServerJanuary 29, 2009 7:50 pm

The ‘desc’ command to get a list of table fields that is common in Oracle and MySql will fail in SQL Server. It turns out it is not sql-standard compliant. Instead, SQL Server uses the following command:

sp_columns myTableName

This will display detailed information about table structure.

If you need just individual columns, use the following command:

select column_name, data_type, character_maximum_length, *  
from information_schema.columns
where table_name = ‘myTableName’

order by ordinal_position 

 

.NET, ExcelJanuary 6, 2009 9:31 pm

Here is a discussion of the captioned issue with a solution posted at the end of the page, pointing to a third-party solution.