This is my sql_fetch command :

$Retval = sql_fetch("SELECT ServerName, Transmission FROM dbo.SrvAuth WHERE ServerName = ?", $MachineCourt);

This command does find the right record based on ServerName but it is always putting the second field, $Transmission, to the value FALSE.

Here is the MS SQL table definition :
Colum Name Data Type Allow Nulls
ServerName varchar(50) Unchecked
Transmission bit Unchecked

Depending of the record that it is fetch, the DB contains about a third of TRUE and 2 third of FALSE for the Transmission field.

Question :
Why do I always fetch FALSE for the Transmission field?


AskedFebruary 18, 2020 - 8:09pm

Answers (2)

Thanks for your answer.
The config file contains more than 500 lines so it may be complex to figure it out.

I have work on the assumption that NXLog and MSSQL do not share the same definition of a boolean field. Boolean field is often seen in the Linux world while MSSQL on Windows is using a "bit" field instead of a boolean. Does the same thing with different name and may be storage way.

I have changed the Table layout to replace the "bit" Transmission field to a varchar(5) and then insert TRUE or FALSE in the field instead of 1 and 0.
Now SQL_FETCH() bring the right information from the field Transmission and I have adjusted the logic to match the new text field instead of boolean.

May be not the best approach but it does the work.

Comments (1)

  • Arkadiy's picture


    It's working, that's most important part.
    About definitions - well, did our best to made syntax writing as native as possible but sometimes it differs from the common way of use.
    In case of doubts please check our manual, if any questions left than just drop us a line.

    Best regards, Arch