SETBIT Function Examples | VantageCloud Lake - Examples: SETBIT Function - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Example: Querying with the SETBIT Function

The following query takes the input argument 23, which has a data type of BYTEINT and a binary representation of 00010111, and sets the value of the third bit to 1. The query result is a BYTEINT value of 23 or binary 00010111.

SELECT SETBIT(23,2);

Example: Querying Input Argument 23 with the ROTATERIGHT Function

The following query takes the input argument 23, which has a data type of BYTEINT and a binary representation of 00010111, and sets the value of the third bit to 0. The query result is a BYTEINT value of 19 or binary 00010011.

SELECT SETBIT(23,2,0);