Skip to main content
SQL Server T-SQL
To Top
Start a New Topic » « Back to the MS SQL Server and Analysis Services group
FullName nvarchar(255) null
)
insert #Files
exec master..xp_cmdshell 'DIR C:*.csv /B /S'
select right(FullName, patindex('%%', reverse(FullName)) - 1) as ShortFileName
,*
from #Files
where not FullName is null
drop table #Files
To Top