BIT fields in database

How do I need to write an update query in order to insert / delete a database entry that includes a BIT field (Yes/No).
I tried:
"INSERT INTO table_name (string_field, BIT_field) VALUES('hello','true')"
and
"INSERT INTO table_name (string_field, BIT_field) VALUES('hello',true)"
as well as
"DELETE FROM table_name WHERE BIT_field='false'"
and
"DELETE FROM table_name WHERE BIT_field=false"
(I'm using Access database - ODBC).
What is the right way to write it???

How do I need to write an update query in order to
insert / delete a database entry that includes a BIT
field (Yes/No).
I tried:
"INSERT INTO table_name (string_field, BIT_field)
VALUES('hello','true')"
and
"INSERT INTO table_name (string_field, BIT_field)
VALUES('hello',true)"
as well as
"DELETE FROM table_name WHERE BIT_field='false'"
and
"DELETE FROM table_name WHERE BIT_field=false"
(I'm using Access database - ODBC).
What is the right way to write it???in access True, Yes and On are 1. False, No and Off are 0.
so for your queries like this...
to insert true
"INSERT INTO table_name (string_field, BIT_field) VALUES('hello',1);"or for false
"INSERT INTO table_name (string_field, BIT_field) VALUES('hello',0);"for your other query
"DELETE FROM table_name WHERE BIT_field=0;"

Similar Messages

  • What is the Function MOdule that returns the fields in database table order

    Hello Folks
      I have a dynamic internal table with fields ( which are not in order). I want to display them in the order of which they are present in the database table? Is there any function module that returns the fields in database order?
    FAQ. Please search before posting your question.
    Edited by: Suhas Saha on Oct 10, 2011 10:19 PM

    Hi,
    You can use this BAPI.
    <b>BAPI_SALESORDER_GETLIST</b>
    Reward if useful.
    Regards,
    Vimal

  • What are the 3-bit field choices for Hw_Arm_Sel in PCI-6601

    Hi,
    I am programming our own driver to operate the PCI-6601. For our application we need hardware arm option. I know it is possible to use 2 counters for that, but NI-TIO should support also hw_arm. Although it is not explained in the registry document at all, after some tedious check in the DDK examples I found that this bits are located in the Gi counting mode register. I know the position of the HW_enable as well as the position of the 3 bits for pin sellect options. What I do not know is What are the 3-bit field choices for Hw_Arm_Sel . I contacted NI support but got no support. How can NI sell boards and when a customer who is not using LAbview or Measurement Studio or DDK, but is implementing his own driver is then so arrogantly turned down from NI? Also, how can NI publish just part of the registers the board support, and when a customer contacs and asks for some registers get not at all support? I can not foretell the missing registers, and it is pretty unprofessional to document just partly the registers of 660x devices. And on request you got nothing.
    I hope someone from the community know about this Hw_Arm_Sel 3 pin options. Otherwise, there is just an option of error and trial. Or simply throw the board in the garbage.
    Dr. Kirco Arsov
    Solved!
    Go to Solution.

    Hi Kirco,
    I have some more information for you :-)
    I haven't been able to speak to the developer who is the most familiar with TIO programming since he's out of the office, but I have come across his notes from when he was writing support for the DAQmx driver.
    As I described earlier, the HW_Arm_Sel bits don't select a connector I/O pin, but an internal trigger signal. There are seven internal trigger lines, and the HW_Arm_Sel bits map directly to the internal trigger signal: 0b000 - 0b111 map to 0d0 - 0d7. In order to route an I/O pin to an internal trigger, you must also write to a few more registers.
    From what I've read, there are two more register families that need to be programmed: TG_x_LevelEdgeReg and TG_x_CombinationReg, where x is the internal trigger number. In your case, you only need one pin from the I/O connector to be your arm start trigger, so TG_0_LevelEdgeReg and TB_0_CombinationReg will suffice for your application.
    TB_0_LevelEdgeReg :: Offset 0x660
    TG_0_LevelEdgeReg is only 8 bits wide, and maps as follows:
    7..6: EdgeMode
    5..0: LESel
    LESel selects the I/O connector pin to use as the source for the internal trigger signal. 0d0 - 0d39 will select the I/O pin of the same number. NB: behavior for TG_x_LevelEdgeReg is more limited for triggers 1-7, and only a small subset of the I/O pins can be selected for those trigger signals. Trigger 0 can use any I/O pin. Setting these bits to 0d63 forces the trigger source low, and can be used as a way to 'unroute' it when you're finished with your program.
    EdgeMode determines whether the TIO will detect an edge of the incoming signal, or just pass the signal level straight through. When detecting edges, it will latch the signal and generate a single TIMEBASE3 pulse instead. 0b00 sets level mode; 0b01 sets rising edge; 0b10 sets falling edge; 0b11 sets either edge.
    TG_0_CombinationReg :: Offset 0x6A0
    TG_0_CombinationReg is 32 bits wide, and has three fields of interest:
    19..16: CombFunction
    5..4: CombTypeB
    1..0: CombTypeA
    CombTypeA controls which trigger subsystem to use as the source for the trigger signal. Since you're coming from an I/O pin and using the edge/level subsystem, you must set these bits to 0b01.
    CombTypeB is similar to CombTypeA, and although you won't be using trigger B, set it to 0b01 to be safe.
    CombFunction performs a simple logic function on A and B. Since you're only using a single I/O connector, you only need the A output, so set these bits to 0b1100.
    All of the other bits should be set to 0b0.
    Unfortunately, I'm unable to test these statements since my test machine is currently being used for another research project. Please let me know what happens if you decide to test.
    Joe Friedchicken
    NI VirtualBench Application Software
    Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
    Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
    Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
    Senior Software Engineer :: Multifunction Instruments Applications Group
    Software Engineer :: Measurements RLP Group (until Mar 2014)
    Applications Engineer :: High Speed Product Group (until Sep 2008)

  • How to populate a field from database through personalization

    I need to populate value of a field from database on self service transaction web page. This field is not configured as EIT or SIT, nor available in seeded transaction.I need to know abt creating some item through personalization where i can write a query . This item will execute the query and display the returned value on the page or something on the similar line.
    Thanks in advance,
    Tanveer

    This workaround should be used as a one time approach till you move to 11.5.10 CU3.
    Here are the details,
    You just need to add the following tags inside the site or function level customization document, remember it should be either site or function only no other levels are supported for adding a new item.
    before adding the following tags you need to find out the following details,
    1. what is the last item in the advancedTable, column or columnGroup in the base metadata. Do not conside the columns inside the columnGroups for this, just the last item which might be a column or a columngroup. Get the if of that item.
    2. You should know what is the view instance and viewattribute you will be attaching
    3. Remember you can only add columns through personalization and not columnGroups.
    4. Replace the appropriate values for the properties amrked with {...} with your own values. You can change the other properties to reflect any specific requirement you want. Make sure you provide correct values.
    <insert after="{the id you got from step 1}">
    <oa:column id="{yourid}" adminCustomizable="true" bandingShade="none"
    cellNoWrapFormat="false" columnDataFormat="textFormat" displayGrid="true"
    rendered="true" scope="." totalValue="false" userCustomizable="false"
    xmlns:oa="http://xmlns.oracle.com/oa">
    <ui:columnHeader xmlns:ui="http://xmlns.oracle.com/uix/ui">
    <oa:sortableHeader id="{yourid}" adminCustomizable="true"
    cellNoWrapFormat="false" initSortSeq="none" prompt="{your prompt}"
    rendered="true" required="no" scope="." sortState="no"
    userCustomizable="false"/>
    </ui:columnHeader>
    <ui:contents xmlns:ui="http://xmlns.oracle.com/uix/ui">
    <oa:messageStyledText id="{yourid}" adminCustomizable="true"
    cellNoWrapFormat="false" dataType="VARCHAR2" initSortSeq="none" queryable="false" rendered="true" required="no" scope="."
    selectiveSearchCriteria="false"
    serverUnvalidated="false" sortState="no" tipType="none" totalValue="false"
    userCustomizable="false" vAlign="middle" viewAttr="{your view attribute}" viewName="{your view instance name}"
    warnAboutChanges="true"/>
    </ui:contents>
    </oa:column>
    </insert>
    You can insert these tags at the end of any existing tags within the <modifications>
    </modifications> tag in the document.

  • Best Practice to Atomic Read and Write a Field In Database

    I am from Java Desktop Application background. May I know what is the best practice in J2EE, to atomic read and write a field in database. Currently, here is what I did
    // In Servlet.
    synchronized(private_static_final_object)
        int counter = read_counter_from_database();
        counter++;
        write_counter_back_to_database(counter);
    }However, I suspect the above method will work all the time.
    As my observation is that, if I have several web request at the same time, I am executing code within single instance of servlet, using different thread. The above method shall work, as different thread web request, are all referring to same "private_static_final_object"
    However, my guess is "single instance of servlet" is not guarantee. As after some time span, the previous instance of servlet may destroy, with another new instance of servlet being created.
    I also came across [http://code.google.com/appengine/docs/java/datastore/transactions.html|http://code.google.com/appengine/docs/java/datastore/transactions.html] in JDO. I am not sure whether they are going to solve the problem.
    // In Servlet.
    Transaction tx = pm.currentTransaction();
    tx.begin();
        int counter = read_counter_from_database();  // Line 1
        counter++;                                                  // Line 2
        write_counter_back_to_database(counter);    // Line 3
    tx.commit();Is the code guarantee only when Thread A finish execute Line 1 till Line 3 atomically, only Thread B can continue to execute Line 1 till Line 3 atomically?
    As I do not wish the following situation happen.
    (1) Thread A read counter from Database as 0
    (2) Thread A increment counter to 1
    (3) Thread B read counter from Database as 0
    (4) Thread A write counter as 1 to database
    (5) Thread B increment counter to 1
    (6) Thread B write counter as 1 to database
    What I wish is
    (1) Thread A read counter from Database as 0
    (2) Thread A increment counter to 1
    (4) Thread A write counter as 1 to database
    (3) Thread B read counter from Database as 1
    (5) Thread B increment counter to 2
    (6) Thread B write counter as 2 to database
    Thanks you.
    Edited by: yccheok on Oct 27, 2009 8:39 PM

    This is my understanding of the issue (you should research it further on you own to get a better understanding):
    I suggest you use local variables (ie, defined within a function), and keep away from static variables. Those local variables are thread safe. If you call functions within functions, its still thread safe. If you read or write to one record in a database using sql, its thread safe (you dont need a transaction). If you read/write to multiple tables and/or records, you probably need a transaction. Servlets are thread safe. You usually dont need the 'synchronized' word anywhere unless you have a function updating/reading a static variable and therefore want to ensure only one user is accessing the static varible at a time. Also do so if you are writing to some resource (such as a file, a variable in applicaton scope, session scope, or resource that everyone uses such as email server). You dont want more than one person at a time to write to it). Note the database is one of of those resources that is handled by transactions rather than the the synchronized keyword (the synchronized keyword is applied to your application only (not other applications that someone is running), whereas the transaction ensures all applications are locked out while you update those records in the database).
    By the way, if you have a static variable, you should have one and only one function (synchronized) that updates it that everyone uses. If you have more than one synchronized function, that updates it, its probably not thread safe.
    An example of a static variable you would use is a Datasource object (to obtain your database connections). You only need one connection pool in your application and you access it via the datasource variable.
    If you're unsure your code is thread safe, you can create two seperate threads that call the same block of functions repeatedly to ensure it works as expected.

  • Missing class indicator field from database row

    Hi,
    I have following problem :
    There is a class inheritance with root interface and 4 subclasses, they are initialized with class indicator field. If I use ReadAllQuery with an interface or some of concrete class as search class - it is working perfect, but if I try to build query with custom selected fields (addPartialAttribute) I always get an error - Missing class indicator field from database row.
    AFAIK This field have not to be mapped in Workbench to real table column, how can I tell TopLink that I will read this indicator field too by reading some custom fields ? I thought TopLink reads such fields automatically, like it does it with primary keys.
    Thank you
    Maksim

    This sounds like an issue with our partial attribute queries and inheritance as the type indicator column must always be read. Can you map the type indicator to a read-only attribute (mark mapping as read-only) and include this in your list of attributes as a work-around?
    Doug

  • How to add a value table to a field in database table?

    Dear Experts,
    Normally a value table can be added in the domain.
    And the field of the database table will have the value table, to which this domain is assigned.
    My question is.. Is it possible to assign a value table to any field ina database table, directly?(i.e. <b>without assigning to that domain</b>)
    If yes.. please let me know the <b>step-by-step</b> procedure clearly.
    Thanks to U in advance.

    Hi sr,
    1. what is the purpose of your value table ?
      -- so that the user can select values
       from some master table , for that field !!!!
    2. This is done by
        CHECK TABLE (foreign key concept)
       (and not value table)
    3. When we create a check table for a field,
       then
       some DEFAULT table is PROPOSED
       . that DEFAULT table is nothing
      but PICKED up from the domain of that field,
      and shown from the value of VALUE TABLE.
      (we can change it however)
    4. so for your purpose,
       just create a CHECK TABLE.
    regards,
    amit m.

  • Database Fields Verify Database - By Programaticaly

    Hi to all,
                  I'm using Crystal Report 11.5, Visual studio 2005 - C#,Asp.Net2.0.
                  My task is by programaticaly add the
    Fieldsobjects,Blobobjects and so on. So in design time i just
    add the Datatable in the CR,
    but during runtime i add some columns in database Table and i get that newly added column but unable to add this field
    (Raised error as "Field Not Found") so what i tried is during
    design time in
    Field Explorer>Database Fields>Right Click and Select
    Verify Database after this work my page is working fine.
    My questions is how to do the same work programaticaly.
    Experts please explain.
    Thanks in Advance

    Yes i found the way it's very simple
    ReportDocument boReportDocument = new ReportDocument ();
    boReportDocument.VerifyDatabase();
    Thats all

  • Generate context file , env in 9.2.0.8 64 bit e-biz database(after upgrade)

    Hi Friends,
    i am using Linux X86-64 bit OS and i have 9.2.0.5 ebiz (32 bit)database
    Now i installed 9.2.0.8 (64 bit) in new home and migrated and upgraded the 32 bit database to 64 bit as well the version from 9.2.0.5 to 9.2.0.8
    Now i want to have the Apps DB Tier environment in my new Home
    How can i generate new context file and generate new environment
    what are all the environment values i have to set before generating context file.
    Please note this is an 64 bit Bit e-biz database
    Please suggest
    Regards,
    DB

    Hi,
    Please see (Note: 820077.1 - How To Recreate The Missing "scripts" Folder Under $ORACLE_HOME/appsutil On the Database Tier Server ?) and (Note: 377495.1 - How To Recreate the /appsutil/scripts/ directory).
    Regards,
    Hussein

  • How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?

    How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?
    Let's say the SQL Server and Oracle Database are in the same Company Internet Network.
    I have the code, but I do not know how to use it. Such as what is System DSN Name? Where could I get it. What does it look like?
    Do I need to install any Oracle Client Software in order to link from SQL Server to Oracle? Or SQL Server has the built-in drivers installed already that I can directly create a Linked Server from SQL Server to Oracle?
    I need to know details. Thanks.
    USE master
    go
    EXEC sp_addlinkedserver
         @server  = '{Linked Server Name}'
        ,@srvproduct = '{System DSN Name}'
        ,@provider  = 'MSDASQL'
        ,@datasrc  = '{System DSN Name}'
    EXEC sp_addlinkedsrvlogin
         @rmtsrvname = '{Linked Server Name}'
        ,@useself  = 'False'
        ,@locallogin = NULL
        ,@rmtuser  = '{Oracle User Name}'
        ,@rmtpassword = '{Oracle User Password}'

    You need an OLE DB provider for Oracle. There is one that ships with Windows, but it only supports very old versions of Oracle. Oracle has an OLE DB provider that you can use. I don't know if it's part of Oracle Client or how it is bundled.
    You should not use MSDASQL or any DSN.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Delete L.H.S spaces from field in database table but not for Report

    Dear Experts
    I m facing a problem...actaually i have replaced 999 by blank in a field of database table record.
    Like :     999 abcde
                 999999 hjklmn
                 9999 klplmj
                 99999 hjsfhh
    I have replaced 9 by blank. and using CONDENSE statement i have avoid the left hand side spaces of 9 in the database table.
    Means the data is updated in database table following below using Condense.
    Like:     abcde
                hjklmn
                klplmj
                hjsfhh
    Now,  the problem is that these spaces is showing in the Report. The left hand side spaces is not deleting from the Report. But these spaces is not showing in the databse table.
    Plz tell me wat is the reason and wat is the solution to avoid these space from the Report.
    Note: That field is Character Field.   KNA1-STRAS
    Thanks and Regards,
    Swapnika

    Hello
    Try to use
    SHIFT c LEFT  DELETING LEADING SPACE.
    instead of
    CONDENSE...

  • Add time field in database table

    Hi Gurus,
    I am trying to add a time field in database table. I know i can add it by using append structure.
    but my problem is when records r creating in database table, the time field also populate with respective system time automatically. i think i need to use events but i have no idea how to use.
    is there any other method available?
    is there any system field for time stamp as date + time?
    Regards
    Giri

    Rob,
    its not updating by table maintainance generator.
    I want to add Time field in table ESTDH. 
    when a new record updated while report version generated the time field also populate with system field.
    is it possible?
    can anybody help me?
    Regards
    Giri

  • Using Min and MAX function on Bit Field

    Hi All,
    I am trying to write a SQL Query where i want to aggregate a bit field along with some  other numerical fields
    I  have a Field of type Bit and it can contain data like
    Scenario 1:              MyBit Field
                       Row1      Null
                      Row2       Null 
                      Row3       Null
    Scenario 2:              MyBit Field
                       Row1      1
                       Row2       1
                      Row3       Null
    Scenario 3:              MyBit Field
                       Row1      0
                      Row2       0
                      Row3       Null
    Scenario 4:              MyBit Field
                       Row1      1
                       Row2       0
                      Row3       Null
    Scenario 5:              MyBit Field
                       Row1      1
        Row2       1
                      Row3       0
    Scenario 6:              MyBit Field
                       Row1      1
                      Row2       1
                      Row3       1
    Scenario 7:              MyBit Field
                       Row1      0
                       Row2       0
                      Row3       0
    These are all scenario i can think of, i want to have sql statement which should return me
    null if all values are null,
    if there is mix of 1, 0 then return NA,
    if there is mix of 1,0,null return NA
    if there is mix of 1's with Null then return 1 ,
    if there is mix of 0's with null return 0 ,
    if there is all 0's return 0
    if there is all 1's return 1
    IS there an elegant way in SQL to handle this
    Note : I have other fields in query which are simply getting SUM.

    Try:
    DECLARE @T table (
    Scenario int NOT NULL,
    col1 int NOT NULL,
    col2 bit NULL,
    UNIQUE CLUSTERED (Scenario, col2, col1)
    INSERT INTO @T
    (Scenario, col1, col2)
    VALUES
    (1, 1, NULL),
    (1, 2, NULL),
    (1, 3, NULL),
    (2, 1, 1),
    (2, 2, 1),
    (2, 3, NULL),
    (3, 1, 0),
    (3, 2, 0),
    (3, 3, NULL),
    (4, 1, 0),
    (4, 2, 1),
    (4, 3, NULL),
    (5, 1, 1),
    (5, 2, 1),
    (5, 3, 0),
    (6, 1, 1),
    (6, 2, 1),
    (6, 3, 1),
    (7, 1, 0),
    (7, 2, 0),
    (7, 3, 0);
    WITH T AS (
    SELECT
    Scenario,
    MIN(col2 * 1) AS min_col2,
    MAX(col2 * 1) AS max_col2,
    COUNT(*) AS cnt
    FROM
    @T
    GROUP BY
    Scenario,
    col2
    , R AS (
    SELECT
    Scenario,
    MIN(min_col2) AS min_col2,
    MAX(max_col2) AS max_col2,
    MAX(cnt) AS max_cnt,
    SUM(cnt) AS total
    FROM
    T
    GROUP BY
    Scenario
    SELECT
    Scenario,
    CASE
    WHEN max_cnt = total THEN CAST(min_col2 AS char(1))
    WHEN min_col2 = 1 AND max_cnt < total THEN CAST(min_col2 AS char(1))
    WHEN max_col2 = 0 AND max_cnt < total THEN CAST(max_col2 AS char(1))
    WHEN min_col2 <> max_col2 AND max_cnt < total THEN 'NA'
    END AS col3
    FROM
    R;
    GO
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • Is there any way to change a field as database item dianamically ?

    Is there any way to change one field as databas item dianamically ?
    We are using two fields. Depending on a specific condition we have to change one field as database item and other as non database item. and vice versa. Help me Please......

    This is because we use OLE. in a specific condition we use MS Excel and in other condition we have to use MS Word. But it stores in to one field.........Thats why ......

  • Compiler Crash: Volatile Bit Fields (reading)

    Can anyone verify that this crashes the Studio 12 C++ compiler?
    typedef struct {
    #if defined(CRASH)
        volatile int crash : 1;
    #else
                  int crash : 1;
    #endif
    } Flags_t;
    int main()
        Flags_t Flags = {0};
        return Flags.crash;  /* reading the volatile bit-field causes the compiler crash */
    }With cc, it compiles fine, and it compiled fine up until some recent patch with CC. 124863-01 seems to work but 124863-03 results in a compiler SEGV.
    Edited by: Mike_Morgan on Apr 17, 2008 2:44 PM
    You'll need to use: -DCRASH to see the compiler SEGV.

    Thanks for filing the bug report. It is CR 6690835, which should be visible at bugs.sun.com in a day or two.

Maybe you are looking for

  • Grid and objects at angle from the artboard

    Hi there... My issue is that the grid, and any shapes (such as a simple rectangle) are at a slight angle to the artboard - see the picture to see what I mean... The artboard has horizontal and vertical sides but the grid is off at an angle. And as yo

  • Error when transfer PR from ECC

    Hi,My experts:      I work in SRM5.0 .PDP     I want to transfer PR form ECC to SRM .I finished the configurtions .Then execute the program "BBP_EXTREQ_TRANSFER".    But ,SRM did not receive the PR.In SLG1 (SRM system ),It dispalys "External partner

  • Enable to create an itune account even with a cresit card

    Hello . I can't create an account at i tunes. it always tells me that my payment methon is not valid if my put my credit card or i choose none. Sorry for my English

  • Problems with Security Update 2009-005

    I attempted to install this security update on my iBook G4 but got an error message towards the end of the process stating that it had not fully installed. Since then my dock has disappeared so I can only access applications through Go in Finder, the

  • Volume of Data in BW

    Hi all, How to know how much volume of data under SAP BW. How much historical data does SAP BW contains presently. Best Reg/ Sus/-