>Msg 156, Level 15, State 1, Line 134 >Incorrect syntax near the keyword 'else' >>
>if exists (select * from #a where s = @FileName) BEGIN > --SET @FileExists = 'Y' > print @PATH + @Filename + ' exists' END >else BEGIN > --SET @FileExists = 'N' > print @PATH + @Filename + ' does not exist' END >drop table #a >Add BEGIN/END blocks if you want to execute more than 1 statement.