October 15, 2003 at 10:04 am
How to open text file in Stored Procedure [SQL v7]?
I have a set of data[50 records] in my application which i will move it to a text file and call a SP to save the data. SP should open the text file, read and insert into database table.
October 15, 2003 at 10:47 am
bulk insert
Or use DTS
Steve Jones
http://www.sqlservercentral.com/columnists/sjones
The Best of SQL Server Central.com 2002 - http://www.sqlservercentral.com/bestof/
October 15, 2003 at 11:33 am
Personally I would use BCP to pull the data in and then push it back out.
Something along the lines of...
SELECT @SQL = 'bcp "SELECT * FROM ' + DB_NAME() + '..' + @tableName + ' QUERYOUT ' + @strOutputFileName + ' -T -t\t -r\n -w'
EXEC master..xp_cmdshell @SQL
Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer
Gary Johnson
Microsoft Natural Language Group
DBA, Sr. DB Engineer
This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.
October 16, 2003 at 5:18 am
I saw a post recently that used xp_Cmdshell to execute 'type filename', should work as long as its plain ascii with no embedded control z.
Andy
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply