May 26, 2004 at 4:40 am
How can I use sql server (store procedure) to update/insert fox pro .dbf files ???
Can anyone help?
Thx
May 26, 2004 at 6:02 am
You could set up a linked server to the foxpro database and use
update openquery(linkservername, 'select colname from tablename where keyname = keyvalue')
set colname = 'updatevalue'
Far away is close at hand in the images of elsewhere.
Anon.
May 26, 2004 at 7:09 am
And how can I set up a lined server to my .DBF file ?
I need to make some dynamic updated, can I do it ?
May 26, 2004 at 7:16 am
These links will help, plus check Books Online
HOWTO: Add a FoxPro Database to SQL Server as a Linked Server
http://support.microsoft.com/default.aspx?scid=kb;en-us;199131
HOWTO: Do SQL Server 7.0 Distributed Queries With FoxPro .dbf Files
http://support.microsoft.com/default.aspx?scid=kb;en-us;199131
Far away is close at hand in the images of elsewhere.
Anon.
May 26, 2004 at 9:41 am
Cool, it's working...
But I need to make dynamic querys like:
select * from openquery(linkedserver,@SQL)
but with openquery I cannot use variables...
How can I make dynamic querys?
May 26, 2004 at 9:59 am
I use dynamic sql and sp_executesql
SET @sql2 = 'select * from openquery(' + @linkedserver + ',''' + @sql + ''')'
EXEC sp_executesql @sql2
Make sure you understand the risks with dynamic sql (injection etc). There are articles on this forum that discuss this subject.
Make sure you have the correct number of single quotes (see example above). If the query in @sql has quoted data then you have to use two quotes, eg
set @sql = 'select col1 from tablea where col2 = ''''X'''''
Far away is close at hand in the images of elsewhere.
Anon.
May 26, 2004 at 10:34 am
Can I use INSERT command to insert rows in my .DBF file ?
Can you post me an example?
May 27, 2004 at 7:29 am
Have not tested, but try this
insert openquery(linkedservername, 'select col1,col2,col3 from tablename where 1=0') values (col1value,col2value,col2value)
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply