Tuesday, March 27, 2012

copy file in stored procedure

All I want to do is copy a text file and add a 1 after the name in a stored procedure that already cretes this file.

CREATE PROCEDURE [dbo].[sp_export_req] AS
DECLARE @.trenutniRed varchar(30),
@.tableRow1 varchar(3000),
@.sql varchar(4000),
@.sql1 varchar(4000),
@.firstColumnName varchar(30),
@.HTMLfile varchar(1000),
@.columnNumber varchar(30),
@.fs int,
@.ole int,
@.file int
declare @.body as nvarchar(225)
CREATE TABLE #temptableHTML (code nvarchar(225))
select @.HTMLfile = 'c:\test_new.txt'

This is the start of the procedure that creates the test_new.txt file. I want to copy the test_new.txt file and name it test_new1.txt. Any help is appreciated. thank you

you could manipulate file name with string functions and build command for xp_cmdshell to copy file XXX.txt in XXX1.txt... or not?sqlsql

No comments:

Post a Comment