hello

I've the following error when I excecute a script for delete the temp table:

error : MSG 156, level 15, state 1, server comp12, line 1 incorrect syntax near the keywork level

the script is:

IF X%SERVER%==X set SERVER=
IF X%SAPW%==X set F=NOPASSAVT && set SAPW=
REM Patronyme du fichier de log général :
IF X%MAINLOG%==X set MAINLOG=%SAUVELOG%
REM Repertoire de travail :
D:
cd \exploit\scripts
REM ***********************************

REM INTEGRATION DANS SAUVE.BAT ou SAUVEAP.BAT : JUSTE APRES LE REDEMARRAGE DE SQL SERVER
echo Exécution de DEL_T.BAT : suppression des tables T% >> %SAUVELOG%




REM ************************************************** ****************************
REM Suppression des tables "T%" des bases d'exploitation CARAT, SAFRAN ou OPTIM'IS
REM ************************************************** ****************************

echo set NOCOUNT ON > d:\exploit\scripts\del_T1.sql
echo set NOCOUNT ON > d:\exploit\scripts\del_T2.sql
echo set NOCOUNT ON > d:\exploit\scripts\del_tsg1.sql
echo set NOCOUNT ON > d:\exploit\scripts\del_tsg2.sql

echo select "use master"+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg1.sql
echo "sp_dboption "+name+",single, true"+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg1.sql
echo "use "+name+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg1.sql
echo "checkpoint "+char(10)+"go"+char(10) >> d:\exploit\scripts\del_tsg1.sql
echo from sysdatabases >> d:\exploit\scripts\del_tsg1.sql
echo where name not in ("master","tempdb","model","msdb","pubs","Northwin d") >> d:\exploit\scripts\del_tsg1.sql
echo go >> d:\exploit\scripts\del_tsg1.sql

echo select "use master"+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg2.sql
echo "sp_dboption "+name+",single, false"+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg2.sql
echo "use "+name+char(10)+"go"+char(10)+ >> d:\exploit\scripts\del_tsg2.sql
echo "checkpoint "+char(10)+"go"+char(10) >> d:\exploit\scripts\del_tsg2.sql
echo from sysdatabases >> d:\exploit\scripts\del_tsg2.sql
echo where name not in ("master","tempdb","model","msdb","pubs","Northwin d") >> d:\exploit\scripts\del_tsg2.sql
echo go >> d:\exploit\scripts\del_tsg2.sql


echo select "select ""drop table "+name+"..""+name+char(10)"+"+""go"""+char(10)+"fr om "+name+"..sysobjects"+char(10)+"where name like ""T%%"" and type=""U"""+char(10)+"go" >>d:\exploit\scripts\del_T1.sql
echo from sysdatabases >>d:\exploit\scripts\del_T1.sql
echo where name not in ("master","tempdb","model","msdb","pubs","Northwin d") >>d:\exploit\scripts\del_T1.sql
echo go >>d:\exploit\scripts\del_T1.sql

isql -n -Usa -P%SAPW% -S%SERVER% /h-1 -w1000 < d:\exploit\scripts\del_tsg1.sql > d:\exploit\scripts\del_T3.sql

echo. >> %MAINLOG%
echo Debut de la suppression des tables "T%%" >> %MAINLOG%
echo. | date | find "/" >> %MAINLOG%
echo. | time | find "." >> %MAINLOG%
isql -n -Usa -P%SAPW% -S%SERVER% /h-1 -w1000 < d:\exploit\scripts\del_T1.sql >> d:\exploit\scripts\del_T2.sql
isql -n -Usa -P%SAPW% -S%SERVER% /h-1 -w1000 < d:\exploit\scripts\del_T2.sql >> d:\exploit\scripts\del_T3.sql

isql -n -Usa -P%SAPW% -S%SERVER% /h-1 -w1000 < d:\exploit\scripts\del_tsg2.sql >> d:\exploit\scripts\del_T3.sql

isql -n -Usa -P%SAPW% -S%SERVER% /h-1 -w1000 < d:\exploit\scripts\del_T3.sql > d:\exploit\scripts\del_t.log


REM Recherche des messages d'erreurs
REM Recherche d'un echec de connexion
find "DB-Library" d:\exploit\scripts\del_t.log && echo Echec de connexion >> %MAINLOG% && goto findel_t
REM echec de positionnement en single user : pas grave
find "Msg 924," /V d:\exploit\scripts\del_t.log > d:\exploit\scripts\del_t1.txt
REM echec de positionnement en single user si deja une connexion : normal
find "Msg 15089," /V d:\exploit\scripts\del_t1.txt > d:\exploit\scripts\del_t2.txt
REM Contrôle des vraies erreurs
find "Msg" d:\exploit\scripts\del_t2.txt > d:\exploit\scripts\del_t3.txt && echo La suppression des tables T%% s'est mal déroulée : consulter d:\exploit\scripts\del_t3.txt >> %MAINLOG%
find "Msg" d:\exploit\scripts\del_t2.txt || echo La suppression des tables T%% s'est correctement déroulée >> %MAINLOG%

:findel_t
IF NOT X%F%==X set SAPW=
set F=
sleep 10
echo. | time | find "." >> %MAINLOG%