Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to determine the column type programatically

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-12 : 09:02:05
satya writes "Hi,
How do I determine the data type of any column programatically. Please respond immediately if you know. I request the answer ASAP."

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2002-04-12 : 09:29:47
You can used the system tables syscolumns and sysobjects to find this out. sysobjects lists all tables/sp/views/etc in the database, and syscolumns lists all the columns and all their properties.
Have fun

Go to Top of Page

motokevin
Starting Member

36 Posts

Posted - 2002-04-12 : 15:42:31
Don't use syscolumns and sysobjects (just a suggestion).

Do this instead:

Select Column_Name,Data_Type
From Information_Schema.Columns
Where Table_Name='MyTable'


SQL has Information_Schema views set up to access this information.

Go to Top of Page
   

- Advertisement -