July 25, 2006 at 1:45 pm
getting error
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '+'.
July 25, 2006 at 1:50 pm
yep you can t do that
you have to prepare file name before in a variable
SET @FileName='E:\Development\Emp\'+@FileName+'.txt'
EXEC Master..xp_fileexist @FileName, @File_Exists OUTPUT
Vasc
July 25, 2006 at 1:57 pm
yeah i did even that..but same problem again.
not getting any syntax error but cudnt process the flow
July 25, 2006 at 2:14 pm
can you post again what you did ?
this one works
SET NOCOUNT ON
DECLARE @File_Exists INT
----------------------------------------------------------
DECLARE @FileName NVARCHAR(50)
SET @FileName='IO'
----------------------------------------------------------
SET @FileName='C:\'+@FileName+'.sys'
EXEC Master..xp_fileexist @FileName, @File_Exists OUTPUT
SELECT @File_Exists as Existss,@FileName as FileNames
SET @FileName=@FileName+'sys'
EXEC Master..xp_fileexist @FileName, @File_Exists OUTPUT
SELECT @File_Exists as Existss ,@FileName as FileNames
Vasc
July 25, 2006 at 2:19 pm
EXEC('BULK INSERT Emp FROM ''E:\Development\Emp\'+@FileName+'.txt''
WITH (formatfile =''E:\Development\Emp\InputFormat.fmt'')')
=
DECLARE @MySQL NVARCHAR(4000)
SET @MySQL ='BULK INSERT Emp FROM '''+@FileName+''' WITH (formatfile =''E:\Development\Emp\InputFormat.fmt'')'
PRINT @MySQL
EXEC (@MySQL)
Vasc
July 25, 2006 at 2:22 pm
Thanks a lot..Finally I got it done.
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply