April 29, 2015 at 2:34 pm
HI,
whenever I use the below script, it throws the below error. Any suggestion, what's going on wrong?
declare @DbFilePath VARCHAR(max)
set @DbFilePath = ' c:\mdndnd\mmnsn\'
if object_id('tempdb.dbo.#fileExist') is not null
drop table #fileExist
create table #fileExist (
fileExists int,
fileIsDir int,
parentDirExists int
)
insert into #fileExist
exec xp_fileexist @DbFilePath
declare @directory_check INT
select @directory_check = [parentDirExists]
from #fileExist
IF @directory_check = 1
BEGIN
END
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Thanks.
April 29, 2015 at 2:43 pm
This works:
declare @sql nvarchar(4000)
set @sql= 'exec xp_fileexist ''' + @DbFilePath + ''''
insert into #fileExist
exec sp_executesql @sql
Gerald Britton, Pluralsight courses
April 29, 2015 at 4:16 pm
HI Britton,
It works.,
Thanks.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply