Stored procedure to read the filenames:
create procedure spReadFolder @path sysname
as
begin
set nocount on
declare @dirfile table(
id int identity(1,1),
FileName sysname NULL )
declare @cmd nvarchar(512)
set @cmd = 'DIR /b ' + @path
insert into @dirfile
exec master..xp_cmdshell @cmd
select * from @dirfile
end
go
Execute stored procedure:
declare @path sysname
set @path = 'D:\SQL_folder'
exec spReadFolder @path
go
Thursday, January 28, 2010
Read file names from the folder
2:43 PM
No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment