Best way to give a default value to a New Column with existing rows

Adding some columns to SQL tables with existing data rows. There are also views created from these tables. The views are used in some report/query software so NULL values are not good. Interested in learning about the best way to set a default value. 
These are the ways that I can think of
1) ALTER TABLE using the DEFAULT to add the column and set the default value
++ Adds a constraint which is not terrible. Constraints are just not used much in this shop.
2) ALTER TABLE to add the column then do an UPDATE statement to update the values
++ might be an issue for tables with millions of rows
3) ALTER TABLE to add the column then use ISNULL in the CREATE VIEW

It is a large table with 444 columns and max row size of 2268. 907k records took 1 minute 38 seconds to UPDATE the column. I have about 12 fields to add to this table and about 44 tables (not all this large of course) so it will take some time to
UPDATE.  Although ... i just tried updating 3 columns in a single UPDATE and it took 1 minute 36 seconds. So If I did all 12 fields in a single UPDATE it would be about the same time as a single Field.  I will think about it.

Similar Messages

  • Best way to put the default values for the Form Items

    Hi,
    I am having a form with lot of default values as mentioned below..
      Field                      value 
      created by             :APPL_USER
      creation_date         SYSDATE
      last_updated_by     :APPL_USER
      last_update_date    SYSDATE
      item1                     value1
      item2                     value2Currently I am using Computation -> After Submit.....so whenever we create/update a record...these computaion takes place and the default values get inserted....THIS IS WORKING PERFECTLY FINE.
    I want to know..if this approach is fine OR we may have some better approach to acheive this...????
    Thanks,
    Deepak

    Deepak,
    Sample trigger code:
    CREATE OR REPLACE TRIGGER  "BINS1_APPLICATION_TBL"
       BEFORE INSERT
       ON APPLICATION_TBL    FOR EACH ROW
    BEGIN
       --  Description: Insert creation_dt, creation_id,
       --              lst_updt_dt and lst_updt_id
       --  Maintenance:
       --  Date        Actor           Action
       --  ====        =====           ======
       --  20-Aug-2009 J. Wells         Create.
       :NEW.creation_id := V('APP_USER');
       :NEW.creation_dt := SYSDATE;
       :NEW.lst_updt_dt := :NEW.creation_dt;
       :NEW.lst_updt_id := :NEW.creation_id;
       SELECT APPLICATION_seq.NEXTVAL
         INTO :NEW.APPLICATION_seq
         FROM DUAL;
    END bins1_APPLICATION_tbl;
    ALTER TRIGGER  "BINS1_APPLICATION_TBL" ENABLE
    /Jeff

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • How to give a default value in an inputText on a Form (Jdev 11G Preview2)

    First Test :
    In the .jspx I have a Form with an inputText :
    -id = inputText1
    -value=#{bindings.ppartId.inputValue}
    In the page Def (in the <methodAction ..for the submit button) I modified the NDValue in order to have
    <NamedData NDName="ppartId" NDType="java.lang.Integer"
    NDValue="${ParticipantInfo.participantId}"/>
    --> After clicking on the submit button I got a null value for the ppartId (in my model method) [In my ManagedBean ParticipantInfo, participantId is OK]
    Second Test
    In the .jspx I have a Form with an inputText :
    -id = inputText1
    -value=#{bindings.ppartId.inputValue}
    I replace the value
    -id = inputText1
    -value=#{ParticipantInfo.participantId}
    --> I saw the correct value when running the form but After clicking on the submit button I got a null value for the ppartId (in my model method)
    So my problem is : I just want to give a default value on an inputText on a form with a Managedbean. How to do that ?
    Could I modify the code of the action ofthe submit button to do that but how ?
    public String saisierapide_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("SaisieRapide");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    }

    Hi,
    if your attribute binding is bound to a variable, then you can achieve this by setting the DefaultValue attribute for the variable to the desired value. E.g.
      <variable Name="ppartIdVariable" Type="java.lang.String"
                DefaultValue="${ParticipantInfo.participantId}"/>
    <attributeValues id="ppartId" IterBinding="variables">
      <AttrNames>
        <Item Value="ppartIdVariable"/>
      </AttrNames>
    </attributeValues>HTH,
    Patrik

  • Is there any way we can set default value for a Date Attribute to current date in Master Data Services

    Is there any way we can set default value for a Date Attribute to current date in Master Data Services.
    I as well wants to know that is there any posibility to show Calendar control while input data into respective date attributes.
    Thanks.

    Hi Anagha,
    So far i havent found any way to set todays date by default from MMI, but i guess this flow should work as workaroud
    1. Add buisness rule which can set a default value when Date = NULL/Blank
    2.get the entity table ,use -select EntityTable from mdm.tblEntity where Name = '<enter entity name>'
    3.Go to that table and add a after update trigger like
    if uda_<entityid>_<attributeid(Date attribute)> = default value
    update uda_<entityid>_<attributeid(Date attribute)> =getdate() where id = <LastUpdatedRow>
    I will check on this too from my side.
    By the way AFAIK i dont think so calendar control integration is possible .

  • Best way to give tablename in create table statement

    hi all,
    what's the best way to give table name while "create statement" in case of performance.. 
    for eg:
    create table tablename(id int,name varchar(20))
    a.) tablename
    b.) [tablename]
    c.) (tablename)
    d.) "tablename"
    pls its urgent..
    thanks in advance..
    lucky

    >b.) [tablename]
    As Naomi pointed it out, the above is dangerous because unintentionally special characters or space can be included and accepted by SQL Server.
    Once you introduce special characters in the table name, you have to use [....] forever.
    Related QUOTENAME:
    http://technet.microsoft.com/en-us/library/ms176114.aspx
    a is the best choice.
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Best way to give access to Library folder, etc.

    Hello.
    I have someone in our studio who needs to access various directories within the root Library folder (mainly for dealing with web/wiki file editing) — what's the best way to give them access to the server for this (assuming they'll be accessing the xserve from another machine on the LAN and not directly logging in on the Xserve itself as it's in a secure room in a rack)?
    I tried using File Sharing and creating aliases or symbolic links to the requires locations, but that didn't seem to work.
    FYI, all users are set up via an OD Master (if that helps)?
    Regards,
    Kristin.

    Hi Kristin,
    What you are describing is a developer having access to files on the server that a running service is using. A common developer situation: modifying and editing files on a remote machine but not in use by the service. The service needs to be restarted to put the modifications into service.
    A setup I'm familiar with is more tolerant of the interaction and provides backup in case things go awry. A repository on the server (subversion or git) is setup to accept versions of the file directories used by a service. Then the latest version is checked out to the service directory. The service is stopped and restarted to load this latest version. If things are not working correctly, then a rollback can be performed to restore service to the previous running version. The developer is provided an ssh connection on the lan to keep secure file transfers to and from the repository.
    Using a tool such as Capistrano provides the automated mechanism to restart service and load any configuration data that may be required. Rollback is just as simple.
    This approach means the service is up as much as possible. Development and testing is accomplished on a remote machine, not the server. Version control is maintained and a backup of known tested files is available for rollback. Lastly, the control of bringing online a new file or capability is allowed in a controlled manner. Security of access to files is limited to those allowed an ssh connection to the repository.
    With subversion preloaded on OS 10.5 Server and git easy to install it is a straightforward solution.
    HTH,
    Harry

  • Default values for files and columns when adding a discoverer porlet

    Hi, i'd like to know how to configure the default value for numbers of columns and files when i add a new discoverer porlet in a portal page.
    The actual default value is 10 files and 6 columns and i always have to increase it to at least 100x100.
    Is there any config file where i can change that?
    I've found a configuration.xml in $ORACLE_HOME/discoverer/config/configuration.xml
    with a section
    <!-- Discoverer Servlet configuration. Defines behaviour of both
    discoverer/plus and discoverer/viewer servlets -->
    but couldnt find a parameter for those items.
    Thanks in advance.
    Daniel Perez

    I think triggers are the best device.
    Scott

  • How to add a default value in a site column for every item in a document library

    HI
    i created a content type with some site columns ,
    and included in a Document library.
    Process ( content type)
    -ProcessNo
    -ProcessName
    after that i uploaded 100 Documents but not  added value in a site column process name.
    now  how i add a default value in a site column for every document in a document library 
    adil

    HI
    i get below error when i change the script 
    PS C:\scripts> C:\Scripts\updatedefaultvalue.ps1
    Cannot index into a null array.
    At C:\Scripts\updatedefaultvalue.ps1:8 char:7
    + IF($i[ <<<< "Title"] -eq $null)
        + CategoryInfo          : InvalidOperation: (Title:String) [], RuntimeExce
       ption
        + FullyQualifiedErrorId : NullArray
    $web = Get-SPWeb http://tspmcwfe:89/
    $list = $web.Lists["test"]
    $item = $list.Items | Where { $_["Name"] -eq "Emc" }
    foreach($i in $items)
    IF($i["Title"] -eq $null)
             $i["Title"] = "test"
           $i.Update()
    adil
    Why are you piping a where in the items? Do you only want to add the "test" to ones matching
    a name?
    If you have ISE installed on your server I recommend you put your code in there and debug it. 
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • Error giving a default value to a date column in the attribute settings.

    When im giving a default value to a date column in the attribute settings i get this error when im running my jsp page (bc4j web application):
    Error Message: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value: 31-dic-2099
    How can i fix that?
    Thank u

    The default date format for oracle.sql.DATE which oracle.jbo.domain.Date extends is "YYYY-MM-DD"

  • My MacBook Pro turns on but not all the way, it gives me an icon of a grey folder with a question mark in the middle, and won't go further that that. Anyone knows why, or what's the problem?

    My MacBook Pro turns on but not all the way, it gives me an icon of a grey folder with a question mark in the middle, and won't go further that that. Anyone knows why, or what's the problem?

    If these do not resolve the issue or if you are not comfortable with proceeding through these steps then take your Mac to an Apple store or an Apple Authorized Service Provider.  An Apple store will perform these initial steps, diagnose the problem, and give an estimate for repairs (if needed).  If the Mac is less than one year old or is covered by AppleCare any repairs would be free.
              Genius reservation http://www.apple.com/retail/geniusbar/ .
              or find an Apple Authorized Service Provider https://locate.apple.com/country

  • What is the best way to transfer my iTunes library to my new mac book pro?

    WHAT IS THE BEST WAY TO TRANSFER MY ITUNES LIBRARY TO MY NEW MAC BOOK PRO?  I AM A NOVICE COMPUTER WIZARD!

    From your Old Computer... Copy your ENTIRE iTunes FOLDER to an External Drive... and then from the External Drive to your New Computer..
    Backup iTunes to an External Drive
    http://support.apple.com/kb/HT1751
    Moving iTunes Media Folder (Mac)
    http://support.apple.com/kb/HT1449
    If your Old Computer is a PC... See Here...
    Move iTunes Library from PC to MAC
    http://www.macworld.com/article/146958/2010/03/move_itunes_windows_mac.html

  • What is the best way to migrate my MacBook Pro to my new Imac desk top, both seem to be running OS X version 10.9.5

    What is the best way to migrate my MacBook Pro to my new Imac desk top, both seem to be running OS X version 10.9.5

    OS X: How to migrate data from another Mac using Mavericks

  • What is the best way to import photos from aperture to my new Lightroom

    What is the best way to import photos from aperture to my new Lightroom ?

    See if this helps
    http://lightroomsolutions.com/articles/migrating-from-aperture-to-lightroom-where-do-i-beg in/

  • How to insert into default values in onli 1 column of a table

    if u create a table with onli 1 column
    which can accept a default value of say
    only 100.
    then how do u actualli enter values into the table.
    is there any data dictionary which stores details about default
    values of a table

    The default value for a column is the value that will be stored
    for that column if you do not provide one in your insert
    statement. If you do provide a value, then it will be stored in
    the column.
    You can query user_tab_columns ( or all_ or dba_)to see the
    default value assigned to a column.

Maybe you are looking for

  • Windows 7 Installation on Satellite C50-A-1JT

    Hi everyone, I've bought a brand new Sattelite C50-A-1JT PSCJGE from Romania with no OS. First i've tried for about a day to install Windows 7 and it won't boot, neither on DVD neither on USB, only Windows 8, but after i've searched about it, i found

  • Compare two pdfs in livecycle designer

    Does anyone know how to compare 2 pdfs in livecycle. So basically what I want is highlight the differences between 2 pdfs. If anyone has any idea it will be really helpful. Thanks.

  • Robot class not working

    I need to make a macro with the robot class that draws a picture in a paint program. For each color in the image (256 colors total) it should change the paint color and drawing each 2x2 pixel that's that color. I made the program and it works correct

  • Navigation to detail form

    Hai, I have a Jframe with two panels, built separately from one another. One panel is the navigation on the left side ( a JTree), and the right panel is the details shown when user selects a tree node. I have to implement various views for the right

  • Can't Save File in Excel 2010 Suddenly

    I can't save my file all of sudden. These Microsoft updates are causing problems and wasting my time. Excel 2010 File - xls Error: This error occurs when you open a Microsoft Office file type blocked by File Block settings in the Trust Center. To ena