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)
 Query to fetch field datatype

Author  Topic 

jpradeep
Starting Member

8 Posts

Posted - 2006-09-29 : 00:12:35
Hi All

How can I fetch particular field/column datatype in a table using sql query?

Database is SQLServer 2000

for eg. Table 'tInfo' contains one column 'Distance'. I want to know whether column 'Distance' is 'int' or 'double'. According to that I have to write function in visual basic 6.0

Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-29 : 00:24:24
select * from information_schema.columns
just add WHERE's as needed.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-09-29 : 00:27:59
[code]
select
DATA_TYPE
from
INFORMATION_SCHEMA.COLUMNS
where
TABLE_NAME = 'tInfo' and
COLUMN_NAME = 'Distance'
[/code]

CODO ERGO SUM
Go to Top of Page

jpradeep
Starting Member

8 Posts

Posted - 2006-09-29 : 06:50:20

Working great.

ThanQ very much.
Go to Top of Page
   

- Advertisement -