Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ^1 mean in SQL call?

Tags:

java

sql

t-sql

SELECT LOWER(pla_lan_code) as locale,
    pla_auto_translate_opt_out_flag^1 as autoTranslationEnabled,
    pte_manual_edit_flag^1 as autoTranslated,
    ftr_created_date as queuedDate,
    ftr_translation_date as translationDate,
    ftr_engine as translationEngine,
    ftr_id as translationId,
    pla_auto_translate_opt_out_flag as translationOptOut

SELECT * FROM property_languages (nolock)
    LEFT OUTER JOIN properties_text_live (nolock)

This query is embedded in Java code. I am trying to convert it into a stored proc. I want to know what ^1 equates to in SQL.

like image 528
Kavita Jawarani Avatar asked Nov 06 '25 16:11

Kavita Jawarani


1 Answers

This isn't standard SQL. In Transact-SQL (used in MS SQL Server and Sybase) ^ is the bitwise exclusive-OR operator.

1 ^ 1 is 0, and 0 ^ 1 is 1.

If the original int stores 0 for false and 1 for true, XORing by 1 would reverse the sense of the original flags.

Guessing that pla_auto_translate_opt_out_flag is an int with 1 for opting out and 0 for enabling autotranslation, using the operator returns 1 for enabling and 0 for opting out.

like image 74
Nathan Hughes Avatar answered Nov 08 '25 09:11

Nathan Hughes