Archive: SQL error handling


SQL error handling
hey all

Excecutes a SQL query
<query> - SQL query to execute

Returns

* "0" Success, "1" Failure
* A message string

this is in MSSQL_OLEDB_plug-in page
****************************************
the problem is:
some time i get errors like this

Output folder: C:\DOCUME~1\basharh\LOCALS~1\Temp\1\sqls
Extract: 01.sql
Extract: 02.sql

C:\DOCUME~1\basharh\LOCALS~1\Temp\1\sqls\01.sql
128

C:\DOCUME~1\basharh\LOCALS~1\Temp\1\sqls\02.sql
128
******************************************

"C:\DOCUME~1\MHK\LOCALS~1\Temp\osql.exe" -Sserver -FD4C06 -ddb1 -Usa -Ppazz -i "Temp\CreateDB\Functions.sql" -n
-1073741515

**********************************************

the 1st error (128) was at SQLserver2005 (64-bit)

the 2nd error (-1073741515)was in SQLserver2000 sp1

how we can know each error means? and i guess there is many errors like this! where to find them all?


Hello,
don't sure what you are missing...
The SQL Plugin pushes on the stack a couple of return values each time.
One value is for success/fail
the other value is for descriptive message. If you get 128 as descriptive message, that is what the sql server returns (and this is strange). Both error codes does not seem to have any meaning on SQL technical documentation. Can you provide some sql script code that shows this behaviour?

Regards
Stefano


thanks for reply,

my SQLs are normal, and it works well.
but i have this errors whn i use my paych @ sql2000sp1 or sql2005 64-bit

when we run sql.sql for ex:


nsExec::ExecToStack '"$Temp\osql.exe" -S${DB_HOST_NAME} -d ${DB_NAME} -U${DB_USERNAME} -P${DB_PASSWORD} -i "$TEMP\sqls\${sqlFile}" -n'
pop $0
DetailPrint $0 ;$0 = 128
pop $0
DetailPrint $0 ;$0 = '' empty


With that usage, 128 is the return value from OSQL
The OSQL documentation states that the return values due to sql errors will be negative (from -1 to -102).
You can force other error codes using RAISERROR or EXIT() in your sql code.

If you use the sql_oledb plugin you get the same result?
if so check if you have something like a 'select 128' as last select in your code (128 could be the value of a variable or of an expression)