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
 General SQL Server Forums
 New to SQL Server Programming
 please solve this query

Author  Topic 

nisar
Starting Member

29 Posts

Posted - 2007-05-19 : 23:43:18
Hi please solve this


DBF file

Id 1
Building 21b
Population 4


Sql server table

Building 21b
Population 8



Now I want to execute a sql script when ever I will run this script
It will not only transfer data between sql server 2000 and dbase file but Also update the corresponding population value in dbf table, which has same building value In sql server table

nisar
Starting Member

29 Posts

Posted - 2007-05-20 : 05:14:54
I got the soluation for your reference



DROP TABLE MAP5

SELECT * INTO MAP5 FROM openrowset('MSDASQL',
'Driver=Microsoft Visual FoxPro Driver;SourceDB=C:\;SourceType=DBF','select * from seeb')

UPDATE MAP5
SET ITEM = 0


UPDATE MAP5
SET ITEM = B.ITEMCOUNT
FROM MAP5 A, MAP B
WHERE A.NAME = B.WHSE


EXEC MASTER..XP_CMDSHELL 'COPY C:\empty.dbf C:\seeb.dbf'


INSERT
INTO OPENROWSET('MSDASQL',
'Driver=Microsoft Visual FoxPro Driver;SourceDB=C:\;SourceType=DBF','select * from seeb')
SELECT * FROM MAP5
Go to Top of Page
   

- Advertisement -