December 31, 2009 at 12:16 am
Hi Guys,
I Executed below Query in SQL server 2005
DECLARE @FileName varchar(255)
DECLARE @ExecCmd VARCHAR(255)
DECLARE @y INT
DECLARE @x INT
DECLARE @FileContents VARCHAR(8000)
CREATE TABLE #tempXML(PK INT NOT NULL IDENTITY(1,1), ThisLine VARCHAR(255))
SET @FileName = '\\1.128.1.14\school\mlecontent\LMS\Contents\995_Module_LESSON I\imsmanifest.xml'
SET @ExecCmd = 'type ' + @FileName
SET @FileContents = ''
EXEC master.dbo.xp_cmdshell @ExecCmd
I got the Error as
The system cannot find the file specified.
Error occurred while processing: '\\1.128.1.14\school\mlecontent\LMS\Contents\995_Module_LESSON.
The system cannot find the path specified.
this error is because there is space in the folder name i e 995_Module_LESSON I so it is not able to read the file...
Is there any way to read the file without renaming the Folder Name in System
Thanks in Advance 🙂
December 31, 2009 at 4:12 am
Did you try using the escape character so that it treats space as a space???
December 31, 2009 at 4:21 am
Ignore the post, it seems to work only within Select.
December 31, 2009 at 4:33 am
The only thing that I can add, is that you shouldn't really be writing code around something that's already wrong. Rename the file and follow the same naming convention all the way through. E.g. File_Name, fileName, FileName
January 6, 2010 at 10:27 pm
Hi Friend,
I got the solution...
DECLARE @FileName varchar(255)
DECLARE @ExecCmd VARCHAR(255)
DECLARE @y INT
DECLARE @x INT
DECLARE @FileContents VARCHAR(8000)
CREATE TABLE #tempXML(PK INT NOT NULL IDENTITY(1,1), ThisLine VARCHAR(255))
SET @FileName = '"\\1.128.1.14\school\mlecontent\LMS\Contents\995_Module_LESSON I\imsmanifest.xml"'
SET @ExecCmd = 'type ' + @FileName
SET @FileContents = ''
EXEC master.dbo.xp_cmdshell @ExecCmd
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply