Updating a DB table with only non-empty values of a work area

Hi everybody,
Is that possible in ABAP to update a table in the database with a work area, but only with non-empty values of this work area?
Example:
data: ls_custom type ZCUSTOMERS_0.
ls_custom-CUSTOMER = '20'.
ls_custom-LASTNAME = 'MyName'.
ls_custom-FIRSTNAME = ' '.
ls_custom-CURRENCY = ' '.
update ZCUSTOMERS_0 from ls_custom.  *" I want that the update clause don't do the update with FIRSTNAME  and CURRENCY fields because they have empty values*
If it's possible, how to do it?
Thanks & regards,
Abdel

Total Questions:  81 (66 unresolved)
Hi,
To my understanding you mean if the database table has values
customer         20
lastname          somename
firstname         firstname
currency          INR
so now after this
data: ls_custom type ZCUSTOMERS_0.
ls_custom-CUSTOMER = '20'.
ls_custom-LASTNAME = 'MyName'.
ls_custom-FIRSTNAME = ' '.
ls_custom-CURRENCY = ' '.
update ZCUSTOMERS_0 from ls_custom.
you want the result as
customer         20
lastname          Myname
firstname         firstname
currency          INR
Is it so? Then Normal update
data: ls_custom type ZCUSTOMERS_0.
ls_custom-CUSTOMER = '20'.
ls_custom-LASTNAME = 'MyName'.
update ZCUSTOMERS_0 from ls_custom.
would do that.
Thanks,
Sri.

Similar Messages

  • Plot empty point in line chart with previous non empty value

    Hello,
    I have a problem to plot series data in SSRS line chart, with the empty point, I don't want use average and zero provided by the report builder, I want use the last non empty data to fill the empty point, tried to use expression =Previous(Field!Value), no
    luck, any one have some good idea?
    P.S. do not want to use query to fill the null with previous non null value, just from the performance point view. at last , the chart should have some line as square wave with different height, if I use average for empty point, it shows slop wave line which
    is not reflect the real production.
    Thanks
    Richard 

    Hi Richard,
    In Reporting Services, if the chart type is a linear chart type (bar, column, scatter, line, area, range), null values are shown on the chart as empty spaces or gaps between data points in a series. By default, empty points are calculated by taking the average
    of the previous and next data points that are not null.
    If we want to use previous value to replace the empty value, please refer to the following steps:
    Right-click the field which displayed in Y axis (Height) to open the Series Properties.
    In the Value field to modify the expression to look like this:
    =iif(isnothing(Sum(Fields!Height.Value)),previous(sum(Fields!Height.Value)),sum(Fields!Height.Value))
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to fill empty cells with previous non empty value?

    Hello 
    rows where cat=2 do not have price and i want to fill it with previous value wich cat=1 for every item
    Table named tb
    id        item_no     price         cat 
    1           I1             5           1
    3           I1                          2          the price must be 5   
    4           I1                          2          the price must be 5  too
    9           I1             2           1
    10         I2             10          1
    11         I2             5           1
    15         I2              10        1       
    28         I2                          2        the price must be 10  
    30         I2             2           1
    32         I2             10          1
    filled table must be like that:
    id        item_no     price       cat 
    1           I1             5           1
    3           I1            
    5           2          
    4           I1            
    5          2          
    9           I1             2          1
    10         I2             10        1
    11         I2             5          1
    15         I2             10        1       
    28         I2            
    10        2      
    30         I2             2          1
    32         I2             10         1
    How can i do that?

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You have no idea,
    do you? Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Why are you so rude to people? Now we have to guess a everything and try to fix your mess. 
    There is no generic “id” in RDBMS; it has to be an industry identifier or “<something in particular>_id”. I like the GTIN. Was that useless vague name supposed to be “<something>_cat” as a category scale? 
    CREATE TABLE Items
    (foo_seq INTEGER NOT NULL, 
     gtin CHAR(15) NOT NULL, 
     unit_price DECIMAL (12,2), 
     foobar_cat CHAR(1) NOT NULL
         CHECK (foobar_cat IN ('1', '2')), 
    CREATE PROCEDURE Add_New_Item
    INSERT INTO Items
    VALUES
    (1, 'I2', 5.00, 1), 
    (3, 'I1', NULL, 2), -- unit price must be 5.00
    (4, 'I1', NULL, 2), -- unit price must be 5.00
    (9, 'I1', 2.00, 1), 
    (10, 'I2', 10.00, 1), 
    (11, 'I2', 5.00, 1), 
    (15, 'I2', 10.00, 1), 
    (28, 'I2', NULL, 2), -- unit price must be 10
    (30, 'I2', 2.00, 1);
    >> rows where cat=2 do not have price and I want to fill it with previous value which cat=1 for every item <<
    Rows in a table are not ordered! There is no concept of “previous row” in RDBMS. This is fundamental. Are you using a sequence that you erroneously call “id”? 
    But that makes no sense! Look at (1, 'I2', 5.00, 1) and then (3, 'I1', NULL, 2). Why does item 'I2' have anything to do with the price of item 'I1'? 
    Can you explain? 
    Table named tb
    id   item_no   price   cat 
    1    'I1',  5    1
    3    'I1',  NULL   2  -- the price must be 5   
    4    'I1',  NULL   2  -- the price must be 5  too
    9    'I1',  2    1
    10   'I2',  10   1
    11   'I2',  5    1
    15   'I2',   10   1   
    28   'I2',  NULL   2   -- the price must be 10  
    30   'I2',  2    1
    32   'I2',  10   1
    filled table must be like that:
    id   item_no   price   cat 
    1    'I1',  5    1
    3    'I1',  5    2   
    4    'I1',  5   2   
    9    'I1',  2   1
    10   'I2',  10   1
    11   'I2',  5   1
    15   'I2',  10   1   
    28   'I2',  10   2   
    30   'I2',  2   1
    32   'I2',  10   1
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Update only non empty fields

    Hi everybody,
    I'm trying to develop a trigger-based solution for a project involving received messages from an MQ queue.
    The messages are all inserted from the queue into a single staging table. (v10.2.0.4)
    Each message's data will need to be either inserted or updated to a destination table based upon a field's value in the staging table.
    I was planning on putting a trigger on the staging table and calling an insert or update procedure based on the staging field's value.
    The inserts are pretty straightforward.
    It's the updates that I'm struggling with - some of the staging fields will be populated, others will be empty. There is no pattern to which fields will or will not be populated.
    I do not want to update the destination table with empty fields - I only want to update fields that contain data.
    Is there an better way than several "if-then check for empty, then update" (one for each field)?
    Maybe some sort of magical dynamic update?
    Any help is greatly appreciated.
    Thanks in advance!

    Hi,
    You can use the NVL function (or COALESCE), which returns the first of its arguments that is NOT NULL.
    Instead of:
    UPDATE  dest
    SET     column_a = x
    ,       column_b = y
    WHERE   id = z;say
    UPDATE  dest
    SET     column_a = NVL (x, column_a)
    ,       column_b = NVL (y, column_b)
    WHERE   id = z;If x IS NOT NULL, then NVL (x, column_a) will return x.
    If x IS NULL, then NVL (x, column_a) will return column_a
    You could also automate this in a BEFORE UPDATE trigger:
    :NEW.column_a := NVL (:NEW.column_a, :OLD.column_a);
    :NEW.column_b := NVL (:NEW.column_a, :OLD.column_b);but if you do, you'll have to disable the trigger to correct mistakes that really should be NULL.

  • Can't update a sql-table with a space

    Hello,
    In a transaktion I'm getting some Values from a SAP-ERP System via JCO.
    I update a sql-table with this values with a sql-query command.
    But sometimes the values I get from SAP-ERP are empty (space) and I'm not able to update the sql-table because of a null-value exception. (The column doesn't allow null-values). It seems that MII thinks null and space are the same.
    I tried to something like this when passing the value to the sql-query parameter but it didn't work:
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    this works but I don't want to have a "_"
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", "_")
    Any suggestions?
    thank you.
    Matthias

    The problem is Oracle doesn't know the space function. But it knows a similar function: NVL --> replaces a null value with something else. So this statement works fine for me:
    update marc set
    LGort = '[Param.3]',
    dispo = '[Param.4]',
    schgt = NVL('[Param.5]', ' '),
    dismm = '[Param.6]',
    sobsl = NVL('[Param.7]',' '),
    fevor = '[Param.8]'
    where matnr = '[Param.1]' and werks = '[Param.2]'
    If Param.5 or Param.7 is null Oracle replaces it with a space in every other case it is the parameter itself.
    Christian, thank you for your hint with the space function. So I remembered the NVL-function.
    Regards
    Matthias

  • SQL Server 2012 Undetected Deadlock in a table with only one row

      We have migrated our SQL 2000 Enterprise Database to SQL 2012 Enterprise few days ago.
      This is our main database, so most of the applications access it.
      The day after the migration, when users started to run tasks, the database access started to experiment a total failure.
      That is, all processes in the SQL 2k12 database were in lock with each other. This is a commom case of deadlock, but the Database Engine was unable to detect it.
      After some research, we found that the applications were trying to access a very simple table with only one row. This table has a number that is restarted every day and is used to number all the transactions made against the system.   So, client
    applications start a new transaction, get the current number, increment it by one and commit the transaction.
      The only solution we found was to kill all user processes in SQL Server every time this situation occurs (no more than 5 minutes when all clients are accessing the database).
      No client application was changed in this migration and this process was working very well for the last 10 years.
      The problem is that SQL 2k12 is unable to handle this situation compared to SQL 2k.
      It seems to occurs with other tables too, but as this is an "entry table" the problem occurs with it first.
      I have searched internet and some suggest some workarounds like using table hints to completely lock the table at the begining of the transaction, but it can't be used to other tables.
      Does anyone have heard this to be a problem with SQL 2k12? Is there any fixes to make SQL 2k12 as good as SQL 2k?

    First off re: "Unfortunatelly, this can't be used in production environment as exclusive table lock would serialize the accesses to tables and there will be other tables that will suffer with this problem."
    This is incorrect. 
    Using a table to generate sequence numbers like this is a bad idea exactly because the access must be serialized.  Since you can't switch to a SEQUENCE object, which is the correct solution, the _entire goal_ of this exercise to find a way to properly
    serialize access to this table.  Using exclusive locking will not be necessary for all the tables; just for the single-row table used for generating sequence values with a cursor.
    I converted the sample program to VB.NET:
    Public Class Form1
    Private mbCancel As Boolean = False
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim soConn As ADODB.Connection
    Dim soRst As ADODB.Recordset
    Dim sdData As Date
    Dim slValue As Long
    Dim slDelay As Long
    'create database vbtest
    'go
    ' CREATE TABLE [dbo].[ControlNumTest](
    ' [UltData] [datetime] NOT NULL,
    ' [UltNum] [int] NOT NULL,
    ' CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    ' [UltData] Asc
    ' )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
    ' ) ON [PRIMARY]
    mbCancel = False
    Do
    ' Configure the Connection object
    soConn = New ADODB.Connection
    With soConn
    .ConnectionString = "Provider=SQLNCLI11;Initial Catalog=vbtest;Data Source=localhost;trusted_connection=yes"
    .IsolationLevel = ADODB.IsolationLevelEnum.adXactCursorStability
    .Mode = ADODB.ConnectModeEnum.adModeReadWrite
    .CursorLocation = ADODB.CursorLocationEnum.adUseServer
    .Open()
    End With
    ' Start a new transaction
    Call soConn.BeginTrans()
    ' Configure the RecordSet object
    soRst = New ADODB.Recordset
    With soRst
    .ActiveConnection = soConn
    .CursorLocation = ADODB.CursorLocationEnum.adUseServer
    .CursorType = ADODB.CursorTypeEnum.adOpenForwardOnly
    .LockType = ADODB.LockTypeEnum.adLockPessimistic
    .Open("SELECT * FROM dbo.ControlNumTest")
    End With
    With soRst
    sdData = .Fields!UltData.Value ' Read the last Date (LOCK INFO 1: See comments bello
    slValue = .Fields!UltNum.Value ' Read the last Number
    If sdData <> Date.Now.Date Then ' Date has changed?
    sdData = Date.Now.Date
    slValue = 1 ' Restart number
    End If
    .Fields!UltData.Value = sdData ' Update data
    .Fields!UltNum.Value = slValue + 1 ' Next number
    End With
    Call soRst.Update()
    Call soRst.Close()
    ' Ends the transaction
    Call soConn.CommitTrans()
    Call soConn.Close()
    soRst = Nothing
    soConn = Nothing
    txtUltNum.Text = slValue + 1 ' Display the last number
    Application.DoEvents()
    slDelay = Int(((Rnd * 250) + 100) / 100) * 100
    System.Threading.Thread.Sleep(slDelay)
    Loop While mbCancel = False
    If mbCancel = True Then
    Call MsgBox("The test was canceled")
    End If
    Exit Sub
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    mbCancel = True
    End Sub
    End Class
    And created the table
    CREATE TABLE [dbo].[ControlNumTest](
    [UltData] [datetime] NOT NULL,
    [UltNum] [int] NOT NULL,
    CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    [UltData] Asc
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = on, FILLFACTOR = 80) ON [PRIMARY]
    ) ON [PRIMARY]
    go insert into ControlNumTest values (cast(getdate()as date),1)
    Then ran 3 copies of the program and generated the deadlock:
    <deadlock>
    <victim-list>
    <victimProcess id="processf27b1498" />
    </victim-list>
    <process-list>
    <process id="processf27b1498" taskpriority="0" logused="0" waitresource="KEY: 35:72057594039042048 (a01df6b954ad)" waittime="1970" ownerId="3181" transactionname="implicit_transaction" lasttranstarted="2014-02-14T15:49:31.263" XDES="0xf04da3a8" lockMode="X" schedulerid="4" kpid="9700" status="suspended" spid="51" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-02-14T15:49:31.267" lastbatchcompleted="2014-02-14T15:49:31.267" lastattention="1900-01-01T00:00:00.267" clientapp="vbt" hostname="DBROWNE2" hostpid="21152" loginname="NORTHAMERICA\dbrowne" isolationlevel="read committed (2)" xactid="3181" currentdb="35" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058">
    <executionStack>
    <frame procname="adhoc" line="1" stmtstart="80" sqlhandle="0x020000008376181f3ad0ea908fe9d8593f2e3ced9882f5c90000000000000000000000000000000000000000">
    UPDATE [dbo].[ControlNumTest] SET [UltData]=@Param000004,[UltNum]=@Param000005 </frame>
    <frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
    unknown </frame>
    </executionStack>
    <inputbuf>
    (@Param000004 datetime,@Param000005 int)UPDATE [dbo].[ControlNumTest] SET [UltData]=@Param000004,[UltNum]=@Param000005 </inputbuf>
    </process>
    <process id="processf6ac9498" taskpriority="0" logused="10000" waitresource="KEY: 35:72057594039042048 (a01df6b954ad)" waittime="1971" schedulerid="5" kpid="30516" status="suspended" spid="55" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2014-02-14T15:49:31.267" lastbatchcompleted="2014-02-14T15:49:31.267" lastattention="1900-01-01T00:00:00.267" clientapp="vbt" hostname="DBROWNE2" hostpid="27852" loginname="NORTHAMERICA\dbrowne" isolationlevel="read committed (2)" xactid="3182" currentdb="35" lockTimeout="4294967295" clientoption1="671156256" clientoption2="128058">
    <executionStack>
    <frame procname="adhoc" line="1" sqlhandle="0x020000003c6309232ab0edbe0a7790a816a09c4c5ac6f43c0000000000000000000000000000000000000000">
    FETCH API_CURSOR0000000000000001 </frame>
    <frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
    unknown </frame>
    </executionStack>
    <inputbuf>
    FETCH API_CURSOR0000000000000001 </inputbuf>
    </process>
    </process-list>
    <resource-list>
    <keylock hobtid="72057594039042048" dbid="35" objectname="vbtest.dbo.ControlNumTest" indexname="PK_CorreioNumTeste" id="lockff6e6c80" mode="U" associatedObjectId="72057594039042048">
    <owner-list>
    <owner id="processf6ac9498" mode="S" />
    <owner id="processf6ac9498" mode="U" requestType="wait" />
    </owner-list>
    <waiter-list>
    <waiter id="processf27b1498" mode="X" requestType="convert" />
    </waiter-list>
    </keylock>
    <keylock hobtid="72057594039042048" dbid="35" objectname="vbtest.dbo.ControlNumTest" indexname="PK_CorreioNumTeste" id="lockff6e6c80" mode="U" associatedObjectId="72057594039042048">
    <owner-list>
    <owner id="processf27b1498" mode="U" />
    <owner id="processf27b1498" mode="U" />
    <owner id="processf27b1498" mode="X" requestType="convert" />
    </owner-list>
    <waiter-list>
    <waiter id="processf6ac9498" mode="U" requestType="wait" />
    </waiter-list>
    </keylock>
    </resource-list>
    </deadlock>
    It's the S lock that comes from the cursor read that's the villian here.  U locks are compatible with S locks, so one session gets a U lock and another gets an S lock.  But then the session with an S needs a U, and the session with a U needs an
    X.  Deadlock. 
    I'm not sure what kind of locks were taken by this cursor code on SQL 2000, but on SQL 2012, this code is absolutely broken and should deadlock.
    The right way to fix this code is to add (UPDLOCK,SERIALIZABLE) to the cursor
    .Open("SELECT * FROM dbo.ControlNumTest with (updlock,serializable)")
    So each session reads the table with a restrictive lock, and you don't mix S, U and X locks in this transaction.  This resolves the deadlock, but requires a code change.
    I tried several things that didn't require a code, which did not resolve the deadlock;
    1) setting ALLOW_ROW_LOCKS=OFF ALLOW_PAGE_LOCKS=OFF
    2) SERIALIZABLE isolation level
    3) Switching OleDB providers from SQLOLEDB to SQLNCLI11
    Then I replaced the table with a view containing a lock hint:
    CREATE TABLE [dbo].[ControlNumTest_t](
    [UltData] [datetime] NOT NULL,
    [UltNum] [int] NOT NULL,
    CONSTRAINT [PK_CorreioNumTeste] PRIMARY KEY CLUSTERED
    [UltData] Asc
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = on, FILLFACTOR = 80) ON [PRIMARY]
    ) ON [PRIMARY]
    go
    create view ControlNumTest as
    select * from ControlNumTest_t with (tablockx)
    Which, at least in my limited testing, resovlved the deadlock without any client code change.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • VPD problem: select for update on join tables with policy on ref table

    In our application we use VPD. Now we ran into an issue. I will try to explain with EMP and DEPT table.
    EMP table has no VPD attached.
    DEPT table has VPD policy that forbids all updates, but allows select. (Policy returns '1=2' for statement type update.
    This query returns no rows:
    select * from emp join dept using (department_id) for update. This makes sense, because I'm going to update both the tables.
    However:
    select * from emp join dept using (department_id) for update of employee_id also returns no rows. THIS IS WRONG. I'm not going to update dept table.
    Any experience with this. Is this a known limitation ?

    I can see all the rows, because there is no select policy.
    However the point is, that VPD should allow me to update the emp table, because there is no update policy.
    With the 'for update of employee_id' clause, VPD should recognize that I'm not going to update the dept table, but only the emp table. But VPD does not recognize this, but applies the update policy of dept to the statement, making the statement to update no rows.
    (Reason behind my question is ADF Business Components, where you have ViewObjects with Referenced Entities. ADF BC generates this type of statement and now we run into this VDP limitation)

  • Updating an oracle table with data from an xml string

    Hi - I need help with the following problem:
    We have a table in the database with a field of xml type. We are going to take each string that gets inserted into the xml type field in the 'xml table' and parse the data into another oracle table with corresponding fields for every element.
    once the record gets inserted into the 'real table' the user might want to update this record they will then insert another record into the 'xml table' indicating an update(with a flag) and then we need to update the 'real table' with the updated values that have been sent in.
    The problem that I am having is that I do not know how to create this update statement that will tell me which fields of the table need to be updated.(only the fields that need to be updated will be in the xml string in the 'xml table').
    Please help me with this - ASAP!

    Are you wanting to upload the file through an Oracle Form or just upload a file? If it isn't via forms, then you should probably post your question here: {forum:id=732}
    You also should post the version of Forms, Database, etc...
    As far as uploading files via a text file, I personally like to use Oracle External Tables even in Forms. You can Google that and there is plenty of information. If you search this forum, then you will see lots of people use UTL_FILE in forms, but you can Google that also for more information.

  • In OWB I need to update the target table with same field for match/update

    In OWb I am trying to update the target table with the match and the update on the same field can this be done. I am getting a error match merge error saying you cannot update and match on the same field. But in SQl my select is
    Update table
    set irf = 0
    where irf = 1
    and process_id = 'TEST'
    Hwo do i do this in OWB.

    table name is temp
    fields in the table
    field1 number
    field2 varchar2(10)
    field3 date
    values in the table are example
    0,'TEST',05/29/2009
    9,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009
    In the above example I need to update the first row field1 to 1.
    Update temp
    set field1 = 1
    where field1 = 0
    and field2 = 'TEST'
    when I run this I just need one row to be updated and it should look like this below
    1,'TEST',05/29/2009
    9,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009
    But when I run my mapping I am getting the rows like below the second row with 9 also is getting updated to 1.
    1,'TEST',05/29/2009
    1,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009

  • Declare the internal table with only one 10 character  field and use

    Hi,
    I want to declare the internal table with only one 10 character  field and use.
    Jaya

    Hi,
    Go ahead. U can declare IT with only one field
    Example:
    data: begin of zcustlist occurs 1000,
                   custmer(10)  type c,
             end of zcustlist.
    Narendra Reddy.
    Edited by: Narendra Reddy C on Aug 8, 2008 11:39 AM

  • Previous non empty value

    Hi,
    I have a situation where I have to update the previous non empty date until there is non empty value. Then use the next non empty value. Data is sorted on group id.
    for example I am creating new field which update the date column which just for example:
    it would be great if there is way to implement using set operation not through cursor.
    thanks in advance
    Zaim Raza
    http://zaimraza.wordpress.com/

    CREATE TABLE #C (X CHAR(1) ,Y INT)
    INSERT INTO #C values(NULL, 1)
    INSERT INTO #C values(NULL, 2)
    INSERT INTO #C values(NULL, 3)
    INSERT INTO #C values('A', 4)
    INSERT INTO #C values(NULL, 1)
    INSERT INTO #C values(NULL, 2)
    INSERT INTO #C values('B', 3)
    SELECT * FROM #C
    ALTER TABLE #C ADD ID INT IDENTITY(1,1)
    SELECT CASE WHEN X is not null
                THEN X
                ELSE (SELECT MIN(X)
                      FROM #C
                      WHERE ID >= t.ID)
           END AS X,
           Y
    FROM #C t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Query only non numeric values in a column

    How to query only non numeric values in a cloumn.
    For example:
    Table1 has a column1(col1)
    Values:
    Row Value
    1 27376
    2 47D99
    3 83039
    4 DKFI*
    5 3J6
    Query should retrieve only rows(2,4,5).
    Thanks! for help
    Murali

    Version 2(PL/SQL) above is not clear enough, It can be tuned to the following:
    -- Create a function
    Create or replace function IsVARCHAR(pCol VARCHAR2) return VARCHAR2
    AS
    vNumber NUMBER := 0;
    begin
      vNumber := to_number(pCol);
      RETURN NULL;
    Exception
      When Others Then
        RETURN pCol;
    End;
    -- To See VARCHAR values (alpha-numeric) only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NOT NULL;
    -- To See NUMBER values only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NULL;Versatility here with PL/SQL, but I personally like SQL versions.
    Thx,
    SriDHAR

  • Cannot find any number on box that begins with 1057,  none of the other numbers work as a "serial number".

    cannot find any number on box that begins with 1057,  none of the other numbers work as a "serial number".

    Serial numbers are normally only applied to the disc case.  If you cannot find one on the disc case then you might be dealing with a redemption code scenario... depends where you bought the software and what the software is.
    Find your serial number quickly
    Redemption Code Help

  • HT5934 i have update my iphone 5 with ios 7 and now it is working very slow.. it is not responsing property.. now what i have to do???

    i have update my iphone 5 with ios 7 and now it is working very slow.. it is not responsing property.. now what i have to do???

    raghav sharma wrote:
    i have update my iphone 5 with ios 7 and now it is working very slow.. it is not responsing property.. now what i have to do???
    Try This...
    Close All Open Apps...  Perform a Reset...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    If no joy...
    Connect to iTunes on the computer you usually Sync with and “ Restore “...
    http://support.apple.com/kb/HT1414

  • Why updates on some tables with always on synchronize mode take * 100 than when asynchronize mode

    I have Always-On synchronization on some databases, We want to change from asynchronize mode to synchronize mode, I tested to see what the  change in performance between the two, and found that in general the select statements keep the same
    duration with and without synchronize mode, most of the update\insert usually take around * 4 times from the asynchronize mode, BUT some updates take much longer. I would like to understand why things take MUCH longer (I understand that working with synchronize
    mode is a 2 phase commit and should take * 4 times, but I can't understand why some of them take 50 - 100 times more).
    1. One query is an update made on a table with few records (up to 40 records), this update run 250K times a day, and a very simple update on this table takes * 98 than without synchronize mode
    1. An update on a big table with 2 million records, using a query that specify the unique column in the primary cluster key, takes 50 times more.
    What are  the factors that have dramatic influence on performance when 2 phase commit (asynchronize mode) is used?

    I've never even looked at the details for SQL Server, but on any kind of a system doing synchronous updates, you have to figure there is a fixed cost, a variable cost, and a queuing cost.  The fixed cost always hits whether its a big transaction or
    a small transaction, let's guess it's about 0.1 seconds for a round trip.  Variable cost depends on how much is updated, let's say it's linear, and is maybe 0.05 seconds for a couple of small rows.  The queuing cost varies from 0 to huge.
    So if you have a small transaction on a local system that takes 0.05 seconds (50 milliseconds), then just one will incur the local 0.05, plus 0.10, plus 0.05, and zero queuing cost, so 0.05 -> 0.20, about 4x.
    But if you have something that runs 250k times a day I hope it's faster, maybe it's only 0.01 seconds locally, and that turns to 0.01 + 0.10 + 0.01 + q, so 0.01 -> 0.12+q, so it's at *least* 12x slower, and maybe if you get 100 of them
    in the same second you start incurring queuing delays also, in fact you may have similar queuing delays on the local system and remote system besides any communications queuing, but if just the synchronization system has some queuing limits and it even gets
    to 0.30 seconds then 0.01 -> 0.42, or 42x, and you start seeing what can happen.  If your local transaction is only 0.001 seconds when not synchronized, then you'd have 100x slowdown just on the fixed overhead!
    IOW, synchronized systems and tons of small, fast transactions just don't fit together very well.
    HTH,
    Josh

Maybe you are looking for

  • An iTunes key command I created no longer works after the recent update

    I created a key command years ago for joining tracks. (Command-J) When the iTunes 11 update happened, it stopped working. I know it is the same key command for View options but it always worked before. So even if I make it a new command, it still won

  • Saving a Doc in excel to PDF?

    Im creating invoices in Excel and then trying to Save as.....to PDF, but when i open the ( Save as type box) there's no option for PDF. Can anyone help? Im running XP and have office 2003 I've uninstalled Adobe twice and re-installed, but still not g

  • IPhoto book ordering problem (error)

    when ordering my book, a window appears stating that an "error occured when trying to connect to Apple Online store. Try again". Trying again does not help. Any suggestions?

  • Unknown error 2131427532 for Premiere Pro 2.0

    Hello. I am using Premiere Pro 2.0 and when my project appears to be just about done burining to the DVD, an error message pops up: "Unknown error 2131427532."  Does anybody know how to fix this?  Is there a better way to get my project onto a DVD (i

  • What Mac OS X versions does Profile Manager support in Server 4?

    I remember that Mavericks server dropped support for lion clients in profile manager when 3.0 came out, and before we decide if we are upgrading to Server 4 and Yosemite, I was wondering if anyone knew what OS's are supported by Profile Manager in Yo