TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Saddamhusen Uadanwala
NA
223
166.5k
List of file using 'xp_cmdshell' path more then 128 char
Nov 23 2016 2:23 AM
I am trying to get list of file in a directory using sql server path having more then 128
character is not working.
DECLARE
@FilePath
varchar
(256)=
'D:\...'
,
--replace your path with a length more then 128 char
@SourceFiles
varchar
(100)=
'Test123456789*.txt'
,
@Query
varchar
(1000)
If Object_Id(
'tempdb.dbo.#FirstTable'
)
Is
NULL
CREATE
TABLE
#FirstTable (
Name
varchar
(256))
SET
QUOTED_IDENTIFIER
ON
SET
@Query =
'master.dbo.xp_cmdshell "dir '
+ @FilePath +
'\' + @SourceFiles +'
/b"'
INSERT
#FirstTable
exec
(@Query)
select
*
from
#FirstTable
truncate
table
#FirstTable
Reply
Answers (
1
)
Secure SQL Server
How To Add Class To Table InstructorCourses