April 2, 2008 at 2:04 pm
Hello everybody,
I have a requirement to write a stored procedure in SQL server 2005 which will be passed a table name as a parameter and will export the resulting table as a Foxpro (.dbf) file.
Since I am new to SQL server, I tried using their import export wizard using the ole db provider for foxpro but ran into the following errors...
Error 0xc0021210: Preparation SQL Task: Executing the query "CREATE TABLE 'CODES_SAMPLE' ('CODE' C(12), 'DESCRIPTION' C(40) )" FAILED with the following error. "Field name is duplicate or invalid". Possible failure reasons: Problem with the query, "resultset" property not set correctly, parameters not set correctly, or connection not established correctly.
I did test the connection and it worked. I am selecting the free table directory option. At times, it throws out an empty structure.
I would appreciate it if you could provide me the code for the foxpro connection.
Thanks!
April 2, 2008 at 4:00 pm
Did you actually check whether the error message you're getting is accurate? Meaning - some of the column names are duplicated or missing?
Also - since you're exporting to DBF, you may need to pay attention to naimng convention, since I don't recall it being nearly as flexible as SQL Server with names. If it's trying to "make some up" to compensate for SQL names it can't accomodate, that might have introduced the dupes it is referring to.
Try setting shortened alias for all columns to be exported to the DBF: 8 characters, no spaces, must start with an alpha character. Each column name must be unique.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
April 2, 2008 at 9:02 pm
Matt,
I appreciate your response. I did check to make sure there were no duplications. I used just two fields - codes and descr. The connection works as well. I had issues with assigning data types in foxpro so fixed that.
I realize foxpro is very rigid but unable to figure the issue out. I think the issue is with the OLE DB provider for Foxpro. Can you or somebody tell me if the conversion is possible or not?
Thanks again for taking the time.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply