Null value in Datetime field

I have a form that inserts data, but the date fields are getting a default value (1/1/1900 12:00:00 AM) even though I don't insert a value for that field. How would I insert a NULL value in the datatime fields in MSSQL.instead of the default value (1/1/1900 12:00:00 AM) that gets inserted?
Here is my insert statement.
<CFLOCK type="exclusive" timeout="10">
    <CFQUERY name="InsertWorkflow"
          datasource="#request.app.DSN#"
          username="#request.app.bsruser#"
          password="#request.app.bsrPassword#">
        INSERT INTO #request.app.DB#.v_NAR_WorkFlowLog
        ([SatApp_ID]
           ,[User_ReqApproval_Logon]
           ,[User_ReqApproval_Date]
           ,[Admin_ReqProcessed_Logon]
           ,[Admin_ReqProcessed]
           ,[Prelim_Approval_Level]
           ,[Prelim_Approval_Date]
           ,[Prelim_Approval_Explain]
           ,[Req_Withdrawn_Date]
           ,[Req_Withdrawn_Explain]
           ,[Req_Denied_Date]
           ,[Req_Denied_Explain]
           ,[User_Req_FinalAppl_Date]
           ,[Admin_FinalAppl_Date]
           ,[DateLastUpdated]
           ,[UpdatedBy])           
        VALUES
           (#SatApp_ID#
           ,'#User_ReqApproval_Logon#'
           ,'#User_ReqApproval_Date#'
           ,'#Admin_ReqProcessed_Logon#'
           ,'#Admin_ReqProcessed#'
           ,'#Prelim_Approval_Level#'
           ,'#Prelim_Approval_Date#'
           ,'#Prelim_Approval_Explain#'
           ,'#Req_Withdrawn_Date#'
           ,'#Req_Withdrawn_Explain#'
           ,'#Req_Denied_Date#'
           ,'#Req_Denied_Explain#'
           ,'#User_Req_FinalAppl_Date#'
           ,'#Admin_FinalAppl_Date#'
           ,'#DateLastUpdated#'
           ,'#UpdatedBy#')                              
    </CFQUERY>
</CFLOCK>
Thanks,
Shearak

Would CFQueryParam work? For example:
<cfqueryparam cfsqltype="CF_SQL_DATE" value="#DateLastUpdated#" null = "#YesNoFormat(NOT Len(Trim(DateLastUpdated)))#">
So, using your given example, your insert would be:
<CFLOCK type="exclusive" timeout="10">
    <CFQUERY name="InsertWorkflow"
          datasource="#request.app.DSN#"
          username="#request.app.bsruser#"
          password="#request.app.bsrPassword#">
        INSERT INTO #request.app.DB#.v_NAR_WorkFlowLog
        ([SatApp_ID]
           ,[User_ReqApproval_Logon]
           ,[User_ReqApproval_Date]
           ,[Admin_ReqProcessed_Logon]
           ,[Admin_ReqProcessed]
           ,[Prelim_Approval_Level]
           ,[Prelim_Approval_Date]
           ,[Prelim_Approval_Explain]
           ,[Req_Withdrawn_Date]
           ,[Req_Withdrawn_Explain]
           ,[Req_Denied_Date]
           ,[Req_Denied_Explain]
           ,[User_Req_FinalAppl_Date]
           ,[Admin_FinalAppl_Date]
           ,[DateLastUpdated]
           ,[UpdatedBy])           
        VALUES
           (#SatApp_ID#
           ,'#User_ReqApproval_Logon#'
           ,'#User_ReqApproval_Date#'
           ,'#Admin_ReqProcessed_Logon#'
           ,'#Admin_ReqProcessed#'
           ,'#Prelim_Approval_Level#'
           ,'#Prelim_Approval_Date#'
           ,'#Prelim_Approval_Explain#'
           ,'#Req_Withdrawn_Date#'
           ,'#Req_Withdrawn_Explain#'
           ,'#Req_Denied_Date#'
           ,'#Req_Denied_Explain#'
           ,'#User_Req_FinalAppl_Date#'
           ,'#Admin_FinalAppl_Date#'
           ,<cfqueryparam cfsqltype="CF_SQL_DATE" value="#DateLastUpdated#" null = "#YesNoFormat(NOT Len(Trim(DateLastUpdated)))#">           ,'#UpdatedBy#')                              
    </CFQUERY>
</CFLOCK>

Similar Messages

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • Null values in Numeric fields of Datasets

    I am wondering if anyone has run into this problem before and
    checking to see if anyone has an elegant solution.
    I have a rather large data set. (actually 5 of them on a
    single page) I am sorting certain columns in a table as numbers so
    i assign the variable " ds1.setColumnType("somenumbercolumn",
    "number")" In most cases Spry works great and it sorts by numbers
    properly. The problem is some of the fields in the XML file are
    null and I am trying to sort them as a number. Spry actually
    adjusts for this (as far as i can tell) and treats them like a 0
    which isn't exactly ideal considering there are real zero values in
    the data. I know spry doesn't currently format numbers:
    So here is my question. Does anyone one have a solution to
    fixing null values in a table so that it is still sortable but
    doesn't display a "0" and instead displays something like "--" or
    whatever. I have the option of editing the XML file as well, but I
    still need the table to sort by number.
    If not null values, how about non numeric fields which can
    still be sorted in a numeric column?

    Hi,
    We have an old post that raised a similar problem with yours.
    The post can be found
    here
    For you situation, you should add an if condition for the
    rows that have 0 and to add a custom string instead 0.
    for (var i = 0; i < numRows; i++)
    if(rows
    [ "field_name"] == 0)
    rows[ "field_name" ] = '--';
    Hope this helps you,
    Diana

  • Check for null value for Date Field

    Hello everyone,
    I have a database that consist of date field and also a bean that will able to access the db.
    here are my example:-
    private int setDate(int date) {
    this.date = date;
    private void getDate {
    return date;
    later, I entered a date value and wanna check whether the date is on the database or not. SO, do you all have any idea?

    Perhaps before passing your date off to a primitive int, you could pass it to an [Integer] object. Then check to see if that object is null;
    Integer d = new Integer(int value);
    if (d == null) {
    }

  • User Created in OIM 11.1.1.5 with null value for mandatory field.

    Hi,
    We had updated one UDF as mandatory field on OIM user form. We can see the * in front of that field. Now if we create the user using web console (Using UI), we are not able to create the user without giving some value in that UDF as it is mandatory. However if we created the user with UDF value as null using Trusted recon, User sucessfully created in OIM. I had attached the screen shot for that user which create in OIM with UDF value as null.
    Is any thing else also need to do to make UDF as mandatory field.
    Regards,
    Sid

    I am not sure this is a bug. Such mandatory checks will often only apply to administrative changes from the GUI. You may not always be able to enforce the same quality of data in reconciled data as you wish to impose for changes made through OIM, and it may prove an issue in some cases if such users could not be reconciled. In this case the use will go into OIM, but you will be forced to populate a value in the mandatory field if you later try to update them in OIM.

  • Removing Null values from character string

    Hi All,
    Can i remove NULL values (hexadecimal - 0000) from character string. I am uploading a file from presentation layer (shared server) and getting NULL values in many fields which i want to remove.
    please assist.
    Thanks for you help..
    Regards,
    Mohaiyuddin

    Hi,
    Most likely, nobody needed it, but if anybody in future will need the solution for related problem  - here's solution:
    data: lv_nullchar type xstring value '0'.
    shift lv_xstring right deleting trailing lv_nullchar in byte mode.
    shift lv_xstring left deleting leading lv_nullchar in byte mode.
    This hack deleting null chars in lv_xstring at end file and at begining of file. Works perfect for me, where i also worked with files.

  • JDBC Receiver Adapter with Null Value

    HI,
    I have configured ID for JDBC Receiver. In my communication channel, I already check Integration of Empty String Values = Null Value. However, when I check the result from audit log, it still shows that SAP XI sends the null value to database. In my understanding, it should not send the field which has null value (It shouldn't be included in sql statement).
    I check this with other scenario. With the same check at Integration of Empty String Values = Null Value, it doesn't send null value to database. It happens only with my first scenario.
    Have anyone ever been through this before? Any suggestion please?
    Thanks,
    Pavin

    Hi,
    1. The occurrence is 0...1
    2. This is the first result with null value (Please see field Error)
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=NULL, Status=2, UpdateDateTime=12/03/2008 13:45:03 WHERE (RequestID=455 AND RecordNo=1)
    Then, I change the option from Null Value to Empty string. This is the result.
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=', Status=2, UpdateDateTime=12/03/2008 13:46:12 WHERE (RequestID=455 AND RecordNo=1)
    Field Error Change from NULL to '
    The expected result from me is that field Error should not exist at all. Please help.
    Thanks,
    Pavin

  • Error in when null values are passed to datefield

    Hi all,
    We are facing some issue with null values in date fields while calling a stored procedure using JDBC Adapter in one of the interfaces.
    When the value is null, XI gives errors in the communication channel.
    Case 1 , When the value is mapped to blank. : The adapter gives an error related to date format. Unsparseable date “”.
    Case 2 , When the value is not mapped at all : The adapter gives an error related to wrong number of arguments for the stored procedure.
    One option for fixing this issue is to hardcode the value to all zeros in a appropriate date format. However this is not acceptable in our case.
    Did anybody face this issue before. If yes what was the approach taken. Can you please let me know if anybody has any inputs on this.
    Thanks in advance,
    Younus

    you can clear the field key tags mandatory in the XML Schema interpreter parameter and make the Empty string value to Empty string from null value.
    For mapping : you can pass a value that is of the same format of date; but you can take your own value in the database since you are parsing the date format from one to other
    thanks
    nikhil

  • BUG in handling of null-value="exception" with optimistic locking

    When commit failed due to value of a field with null-value="exception" being
    null JDO_LOCK get incremented and subsequent commits (after supplying valid
    not null value for the field) will fail with concurrent modification
    exception. This JDO_LOCK increment does not happen to the instance itself
    (or at least my test does not show it) but to an instance to who's
    collection the instance in question belongs. For example
    We have Position, which have a collection of Addresses (inversion based
    collection)
    I am create a new Address, add it to Position collection commit it fails
    because one of the required fields of an Address is null. Every time I
    attempt commit and fail it will increment Position's JDO_LOCK

    I need to add that if I put throw JDOUserException in jdoPrestore() in case
    if the field in question is null (to avoid null-value="exception" check)
    everything works as expected no problems with JDO_LOCK is present
    "Alex Roytman" <[email protected]> wrote in message
    news:agklrf$brk$[email protected]..
    When commit failed due to value of a field with null-value="exception"being
    null JDO_LOCK get incremented and subsequent commits (after supplyingvalid
    not null value for the field) will fail with concurrent modification
    exception. This JDO_LOCK increment does not happen to the instance itself
    (or at least my test does not show it) but to an instance to who's
    collection the instance in question belongs. For example
    We have Position, which have a collection of Addresses (inversion based
    collection)
    I am create a new Address, add it to Position collection commit it fails
    because one of the required fields of an Address is null. Every time I
    attempt commit and fail it will increment Position's JDO_LOCK

  • Selection of Null Value in Transformation file

    Hi Guru's,
    I've been trying to select NULL values of a field in transformation file but unfortunately system always gets both null and filled values of the field ALTHOUGH i had maintained the Selection Option.
    Data management package is: Load Transaction Data from BW InfoProvider UI
    The technical name of field: 0FLAG
    I've tried each possibilities as in below
    SELECTION: 0FLAG, *STR()
    SELECTION: 0FLAG, *STR();
    SELECTION: 0FLAG, ""
    SELECTION: 0FLAG, " "
    SELECTION: 0FLAG, NULL
    SELECTION: 0FLAG, *STR(#)
    SELECTION: 0FLAG, #
    SELECTION: 0FLAG, "#"
    Doesn't work.
    thanks in adv. for your precious supports

    Hi Sadi,
    I understand your question that, you want to load tr. data from infocube and you have a trouble with one field which name is "0flag" in this cube, right? If your case is above, you need conversion file for flag, and convert like that # = "DUMMY" or sth.
    Or, you can solve in BW with transformation file routine.
    I hope, it will help you.
    Thanks.

  • QAAWS- Null Value Bunching Issue

    Post Author: joseph_atkinson
    CA Forum: Xcelsius and Live Office
    I  have created a very simple QAAWS xml that I am using in a Xcelcius report. I have a problem when I pull the data from the database. When the Xcelcius report pulls data, if there is a missing row, instead of leaving it blank, the rest of the data bunches up. i.e QAAWS table null 1 10 12 null 1 Xcelcius report 1 10 12 1 Is there a resolution to this?

    Post Author: amr_foci
    CA Forum: Xcelsius and Live Office
    you can use NVL to replace the null values of this field to Zero or any other values you want, you can make this at the universe level at this object select statement
    good luck

  • Getting a null when trying to access DateTime fields (that I've added) from my work item

    I'm getting a null when trying to access (custom) DateTime fields from my work item.
    I've got a customized work item with 'extra' string and datetime fields.
    <FieldDefinition name="Design Version" refname="XXX.DesignVersion" type="String" reportable="dimension" />
    <FieldDefinition name="Date Closed" refname="XXX.DateClosed" type="DateTime" reportable="dimension" />
    This code fails:
    WorkItem workItem = workItemStore.GetWorkItem(workItemId);
    var tt1 = workItem["XXX.DesignVersion"];//works
    var tt3 = workItem["XXX.DateClosed"]; //tt3 == null, fails also for html fields
    Any idea what's up? thanks

    Hi TimB,  
    Thanks for your post.
    What’s the version of your TFS?
    If you open this work item in VS, there’s no date value in your Date Closed field? Please try below code snippet:
    if (wr.Fields["XXX.DateClosed"].Value
    == null)
    Console.WriteLine(wr.Fields["XXX.DateClosed"].Value);
    else
    Console.WriteLine(wr.Fields["XXX.DateClosed"].Value);
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to hide a field based on the value of a field in a different subform - null check doesn't work!

    I'm using Javascript to set the actions. I need to hide a text field if the value of a field in another sub-form is null.
    - tried checking the value of the other field for null - doesn't work
    - tried setting a variable str2 where I know the value of the other field is available then checking that variable when I initialize the text field - doesn't work
    What am I missing?

    Hi.
    Try this in the originating sub form referring to the text field (X). 
    if (this.rawValue = 1)
              X.presence = "visible";
    else if (this.rawValue = null)
              X.presence = "hidden";

  • Null value for int and datetime date type in xml schema

    hi:
    I am embarrassed by a qustion in xml schema; i defined a xml schema file like
    this:
    <elementFormDefault="qualified" attributeFormDefault="qualified">
    <xs:element name="test">
    <xs:annotation>
    <xs:documentation>Comment describing your root element</xs:documentation>
    </xs:annotation>
    <xs:complexType>
    <xs:sequence>
    <xs:element name="name" type="xs:string"/>
    <xs:element name="password" type="xs:string" nillable="true"/>
    <xs:element name="user" type="xs:int" nillable="true"/>
    <xs:element name="s_time" type="xs:dateTime"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    and I send this file to workflow clientrequest() node, I wanted to receive data
    in this schema file.but when i send null value to the element "user" and "s_time"
    in workshop test tool(test soap),and use function in xmlbean like isNilUser or
    isNilStime, one error occur.
    I don't kown why, I had to ask the engineer of bea in china, one told me a bug.
    is that true?

    Visakh16 I cant agree more with you on it, it is good but in production u cant have them change maxrows. I think
    Patrick  Hurst is a better option. debug the package have it running and move up
    Please mark as helpful and propose as answer if you find this as correct!!! Thanks,Dia Agha .
    Hmm..Why do you need to change it in production?
    What I suggested was to tweak the setting in dev machine so that it interprets the Excel file datatypes correctly when doing development. Once mapping is set correctly then it will work fine when in production or in any other environment. The tweaking is
    just to make sure it interprets the datatype correctly at design time and has nothing to do with production deployment 
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • NULL value not validated for a Required field

    Hi,
    I have added a MessageLovInput item to the expense header page (/oracle/apps/ap/oie/entry/header/webui/GeneralInformationPG), and have made the Required Value to True. But I do not get any error when I navigate to the next page without populating the field. If I enter in incorrect information, it validates it against the LOV, but not for null values.
    Any pointers to make the field validate NULL values?
    Thanks,
    Ashish

    Yeah.. I can see the Required field indicator (*) next to the field. I have tried with all the values (uiOnly, ValidatorOnly, Yes etc.), but it does not validate NULL values.
    I'll try to handle this in the controller, but would prefer if this can be done by personalization.
    Ashish

Maybe you are looking for

  • Performance degradation in j2sdk1.4 than jdk1.3 for jdbc with oracle

    Hi All I am working on performance issues regarding response time . i have upgraded my system from jdk1.3 to j2sdk1.4 . I was expecting the performance gain in terms of response time in j2sdk1.4. but to my surprise it shows varied results with my app

  • Select Apps to appear in 'Open In'

    It appears that iPad limits only 10 apps to appear in the 'Open In' menus (e.g., the menu in the mail client). Is there any way of selecting which apps will appear here? E.g., I used to be able to see GoodReader as one of the options, but now it is g

  • Displaying category portlets in alphabetic order

    Hi Folks, When I publish a Category Portlet all items inside this portlet appear in a randomic order. I wish they could appear in alphabetic order. Is that possible ? How can I do it ? Thanks!

  • Can't start or "please shutdown" message, after ¿kernel problem? need help!

    I'm new to mac world, just bought a mac book less than 1 month ago... After Safari crashed, and also "force quit" crashed I've had to turn off the computer by pressing 6 secs the power button. After that, when I started, a "kernel problem" appeared.

  • I logged out of iCloud and lost over 2,000 photos

    I Logged out of my iCloud account and I logged back in later, but I realized I had lost of 2,000 photos. I have looked on other iCloud devices,but have found nothing. I would try to restore my iPhone to the back up from a couple months ago, but then