Wednesday, March 7, 2012

HELP: update a table from a text file

I have a field in a DB that I want to update with the contents of a
text file. I retrieved the contents of the text file FROM the entry
but now that I edited them, I want to put them back.
This text file has only a single entry in it. No row/column
delimeters needed.I tried using the Enterprise Manager import data
wizard but it doesn't do what I want.
I guess the sql statement would look something like this:
Update mytable
Set data = contents of textfile
WHERE data LIKE '%uniquething%'
HELP
JohnYou could set up a linked server to the text file and read the value in
TSQL. Pls have a look at the example "F. Using the Microsoft OLE DB Provider
for Jet to access a text file" at
http://msdn2.microsoft.com/en-us/library/ms190479.aspx for more info.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

No comments:

Post a Comment