472,102 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Linked server and text file...

Hi i am trying to use text file to write a value as soon as there is any update/insert into a table.
for that i am using a text file and made a linked server relation with it.....
and inserting into the needed value in the text file usind linked server insert command.....

Till here its working fine....
now with time the text file is growing and i only needed the latest value from the text file.....
so i want to truncate the values from table.....
whenever i am truncating or deleting i am getting the error..


I'll explain what i did....

1. create folder [C:\testSQLEvent]
2. create file Sample.ini
3. copy the follwing content
ColNameHeader = False
Format = CSVDelimited
CharacterSet = ANSI
Col1=ProductID short
Col2=ProductName char width 30
Col3=QuantityPerUnit char width 30
Col4=UnitPrice currency
Col5=Discontinued bit
4. create file named Sample2.txt
5. create linked server

EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\testSQLEvent\',
NULL,
'Text'
GO

6. --Set up login mappings.
EXEC sp_addlinkedsrvlogin txtsrv, FALSE, sa, NULL
GO
7. view listing of tables
EXEC sp_tables_ex txtsrv
8. view all list of that table
SELECT * FROM txtsrv...[Sample2#txt]
9. insert into table
insert into txtsrv...Sample2#txt( slNo , ItemName, ItemDescription,price,status)
values(5,'Test item','test item description',$300.00,'true')
10. view all list of that table
SELECT * FROM txtsrv...[Sample2#txt]

Errors faced
1.
update txtsrv...Sample2#txt set ItemName ='ABCED', ItemDescription='xyzw',price=$30000,status='true' where slNo=5
2.
delete from txtsrv...[Sample2#txt]
3.
drop table txtsrv...[Sample2#txt]

please help me out............
i need it asap.......
Nov 25 '06 #1
0 3814

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Ervs Sevilla via SQLMonster.com | last post: by
8 posts views Thread by Ootyguy | last post: by
2 posts views Thread by Robert McGregor | last post: by
reply views Thread by Igor | last post: by
7 posts views Thread by franc sutherland | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.