Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro Schema from SQL? 1

Status
Not open for further replies.

gcoast

Programmer
Dec 17, 2003
39
US
Does anyone know if there is a way to get the schema of a FoxPro .dbf table using SQL? I'm looking into using Open query but haven't found a way to perform a FoxPro command i.e. List Structure, to return this info.

Why you may ask, well we have hundreds of legacy FoxPro tables that are due to be imported into SQL and I have been asked to compile a SQL query showing this information %-(

Thanks in advance,

gc
 
I don't think you'll be able to do this from SQL Server directly. You could try something like this maybe;

select *
into #temptbl
from openquery([<foxpro tables>],'select * from <table>')
where 1=0

This will create a temporary SQL table from the foxpro table, then you can do

EXEC tempdb.dbo.sp_help #temptbl

The data types will be not be Foxpro data types though, but the ones assigned by the ODBC or SQL when it imported the data (e.g. numeric will probably become float etc.), but you get the column names and sequence correctly.

or you could get into the tempdb sysobjects, syscolumns and systypes tables directly to make your own report.

HTH

Nathan
[yinyang]
----------------------------------------
Want to get a good response to your question? Read this FAQ! -> faq183-874
----------------------------------------
 
Nathan,

Thanks for your quick response I think I will be able to use your suggestion.

gc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top