how to delete first row in the textfile data
-
Monday, March 04, 2013 9:36 AM
i want delete first row in the text file
before deleteing i want to copy the data to another text file
- Moved by Charlie LiaoMicrosoft Contingent Staff Tuesday, March 05, 2013 3:00 AM
All Replies
-
Monday, March 04, 2013 9:40 AMAnswerer
You can create a linked server to the text file.
EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'e:\txtsrv', -- the directory that will hold your text file(s)
NULL,
'Text'
select Col1,Col2,Col3,Name1,Name2,Address1,Address2,City,ST,Col10,Col11,Col12,Col13
into #temp
from txtsrv...enrhead#txt
select * from #temp
go
drop table #temp
EXEC sp_dropserver txtsrv
EXEC sp_droplinkedsrvlogin 'txtsrv', NULL
EXECUTE sp_addlinkedsrvlogin 'txtsrv' , False, NULL, NULL, NULLBest Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Sunday, March 10, 2013 4:28 AM
- Marked As Answer by Kalman TothMicrosoft Community Contributor, Moderator Monday, March 11, 2013 3:30 PM

