Getting Changed [Status] rows between multiple rows in SQL Server 2012 based on MonthYear Field

I am trying create Stored Proc which takes 2 inputs from user  @PreviousMonthYear,@CurrentMonthYear
Below is my table schema.[TableIPPortStatus]
Such 1000's of rows will be available in TableIPPortStatus for every IP Port combination for every Scan. Stored Proc will take input as @PreviousMonthYear = 'Jan-2013' and @CurrentMonthYear = 'Feb-2013'
Expected stored proc o/p is to get changed status in @CurrentMonthYear rows compared with the same IP/Port combination from @PreviousMonthYear rows. so for for above e.g. expecting to get below result.
Since in Scan 2222 Port 80 of IP 1.0.0.0 got closed & Port 80 of IP 1.0.0.1 got open and for 1.0.0.2 status was unchanged.
Also, if any new IPPort combination is added in Feb-2013 that needs to make available in the output.
Please suggest way to accomplish this in SQL. Thanks in Advance!

DId you try this? ACtually you dont even need prevmonthyear parameter. you can simply get result using single parameter
If its sql 2012 this is very easy
DECLARE @CurrentMonthYear varchar(30)
SET @CurrentMonthYear = 'Feb-2013'
SELECT ScanId,MonthYear,IP,Port,Status
FROM
SELECT *,
LAG(Status,1,'') OVER (PARTITION BY IP,Port ORDER BY CAST('01-' + MonthYear AS datetime)) AS PrevStatus
FROM Table
)t
WHERE PrevStatus <> Status
And if its sql 2008 or below
DECLARE @CurrentMonthYear varchar(30)
SET @CurrentMonthYear = 'Feb-2013'
;With CTE
AS
SELECT *,
ROW_NUMBER() OVER (PARTITION BY IP,Port ORDER BY CAST('01-' + MonthYear AS datetime)) AS Seq
FROM Table
WHERE MonthYear = @CurrentMonthYear
)t
SELECT c1.*
FROM CTE c1
LEFT JOIN CTE c2
ON c2.IP = c1.IP
AND c2.Port = c1.Port
AND c2.Seq = c1.Seq - 1
WHERE c2.Status <> c1.Status
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Getting error while installing reporting servcies on existing sql server 2012.

    Hi Expaerts,
     sql 2012 sp1:
    getting error while installing Reporting services on existing sql server. at final step
    Error on scren: install_rsharepoint_cpu64_action : roll back , rolling back action.
    error on popup windows:  ' one or more files required to restore your computer to its previous state colud  not be found. restoration will not be found.
    Thanks in advance.

    Hello,
    Please help to collect the useful log information while install SQL Server Reporting Services. Here is the article for your reference, please see:
    Navigating the Setup Logs when you install SQL Server 2012 Reporting Services:
    http://blogs.msdn.com/b/jtarquino/archive/2012/03/14/navigating-the-setup-logs-when-you-install-sql-server-2012-reporting-services.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • Stored procedure to insert into multiple tables in sql server 2012, using id col from one table to insert into the other 2

    Hi all,
    Apologies if any of the following sounds at all silly but I am fairly new to this so here goes...
    I have 3 tables that require data insertion at the same time. The first table is the customers table, I then want to take the automatically generated custid from that table and inser it into 2 other tables along with some other data
    Here's what I have so far which does not work:
    CREATE PROCEDURE CustomerDetails.bnc_insNewRegistration @CustId int,
    @CompanyName varchar(100),
    @FirstName varchar(50),
    @LastName varchar(50),
    @Email nvarchar(254),
    @HouseStreet varchar(100),
    @Town smallint,
    @County tinyint,
    @Postcode char(8),
    @Password nvarchar(20)
    AS
    BEGIN
    begin tran
    insert into CustomerDetails.Customers
    (CompanyName, FirstName, LastName, EmailAddress)
    Values (@CompanyName, @FirstName, @LastName, @Email)
    set @CustId = (select CustId from inserted)
    insert into CustomerDetails.Address
    (CustomerId, HouseNoAndStreet, Town, County, PostCode)
    values (@CustId, @HouseStreet, @Town, @County, @Postcode)
    insert into CustomerDetails.MembershipDetails
    (CustomerId, UserName, Password)
    values (@CustId, @Email, @Password)
    commit tran
    END
    GO
    If anyone could help with this I would very much appreciate it as I am currently building an online store, if there's no registration there's no customers.
    So to whom ever is able to help, I thank you whole heartedly :)

    I hope by now it is apparent that statements like "doesn't work" are not particularly helpful. The prior posts have already identified your first problem.  But there are others.  First, you have declared @CustID as an argument for your
    procedure - but it is obvious that you do not expect a useful value to be supplied when the procedure is executed.  Perhaps it should be declared as an output argument so that the caller of the procedure can know the PK value of the newly inserted customer
    - otherwise, replace it with a local variable since it serves no purpose as an input argument.
    Next, you are storing email twice.  Duplication of data contradicts relational theory and will only cause future problems. 
    Next, I get the sense that your "customer" can be a person or a company.  You may find that using the same table for both is not the best approach.  I hope you have constraints to prevent a company from having a first and last name (and
    vice versa).
    Next, your error checking is inadequate.  We can only hope that you have the appropriate constraints to prevent duplicates.  You should expect failures to occur, from basic data errors (duplicates, null values, inconsistent values) to system issues
    (out of space).  I'll leave you with Erland's discussion for more detail:
    erland - error handling.
    Lastly, you should reconsider the datatypes you are using for the various bits of information.  Presumably town and county are foreign keys to related tables, which is why they are numeric.  Be careful you don't paint yourself into a corner with
    such small datatypes.  One can also debate the wisdom of using a separate tables for Town and County (and perhaps the decision to limit yourself to a particular geographic area with a particular civic hierarchy). Password seems a little short to me. 
    And if you are going to use nvarchar for some strings, you might as well use it for everything - especially names.  Also, everyone should be security conscious by now - passwords should be encrypted at the very least.
    And one last comment - you really should allow 2 address lines. Yes, two separate ones and not just one much larger one.

  • Some of the SQL Server 2012 are not getting monitored in SCOM 2012 SP1.( basics monitoring is happening, expect SQL role)

    Found that all the SQL servers are getting monitored, expect few servers which are having SQL server 2012 role.
    proxy is enabled for these servers, when I checked discovered inventory for SQL 2012 database unable to find these servers in that list.
    and other servers having SQL Server 2012 monitoring properly issue is with only few servers.

    Hi,
    thanks for the all the input, we are using service account as windows account instead of action account !!
    will that also affect discovery of SQL role?
    and also found that there are many alerts in SCOM console, with alert description :
    SQL Server cannot authenticate using Kerberos because the Service Principal Name
    (SPN) is missing, misplaced, or duplicated.
    please let me know how we can resolve this issue, will it affect SQL discovery as well ?

  • INSERTED Table - When it gets populated with single or multiple rows?

    Hi,
    I'm trying to create a trigger which then insert to a table. i'm wondering when does the INSERTED table gets populated with single or multiple rows?
    Should I always assume that the INSERTED Table will contains several rows? What does the scope of the INSERTED table in the trigger, isn't based on the user session?
     The reason why i asked this is because as far as i know inserted table may contain several table when the trigger fires which is why I use cursor to insert  records in the table ( there's a behind why i use cursor).
    But if the inserted table will only contain a single record during the session of the trigger then i can avoid the cursor.
    Thanks.

    But since we control the transaction process and we know for a fact that user will only be able to save a record one at a time, do we still expect multiple rows? I just want to have a clear concept on the INSERTED table.
    ...and then the DBA or someone else sees fit to enter a number of rows directly from a query window. And don't laugh. That is bound to happen sooner or later.
    However, just because this can (and will) happen does not mean that you need to handle it on equal footing with the normal case user entering data through the application. What you cannot permit yourself to is to drop the DBA case on the floor, that is write
    the trigger as if there would either be single-row inserts and produce incorrect results for multi-row inserts.
    But, yes, allowing yourself to use a cursor, if you want to reuse the existing stored procedure is feasible. That is also the more drastic solution suggested by Tom to add an explicit check that disallows multi-row inserts.
    Finally, permit me to comment on this:
    Additionally, it's  difficult to use the code below as i need to pass the identity id of tbl_A to tbl_B
    You can use the OUTPUT clause to capture the values, but that requires that you have something you can map the identity values to in the columns you insert, and this is not always the case. However, there is a lot simpler solution to the problem: don't
    use IDENTITY. IDENTITY is one of these over-used and over-abused features in SQL Server. You need it when you want to support high-concurrency inserts, because rolling your own requires a serialisation point. But with a moderate insertion frequency, IDENTITY
    only gives you headache.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Split single row in multiple rows based on date range

    I need sql script that can split single row in multiple rows based on start date and end date column in table.
    Thank you

    I agree to your suggestion of having a dates table permanently in the database. Thats how we also do for most of our projects as well
    But in most projects the ownership  of table creation etc lies with the client as they will be the DBAs and will be design approval authorities. What I've seen is the fact that though
    many of them are in favour of having calendar table they dont generally prefer having a permanent table for numbers in the db. The best that they would agree is for creating a UDF which will have
    tally table functionality built into it based on a number range and can be used in cases where we need to multiply records as above.
    Wherever we have the freedom of doing design then I would also prefer creating it as a permanent table with required indexes as you suggested.
    >> many of them are in favour of having calendar table they dont generally prefer having a permanent table
    Those people do not understand about database and are not DBAs :-)
    It is our job to tell them what is right or wrong.
    ** This is a real story! I had a client several years back, who was the CEO of a software company.
    He use the query:
    select * from table_name
    In order to get the last ID!
    The table_name was actually a view that took data from several tables, and the main table that he wanted to get the ID included several string columns, with lot of data!
    he actually pulled all this data to the application, just to get the lat ID in a specific table!
    It is our job as Consultants or DBAs to fix's his misunderstanding :-)
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Single row to multiple row

    Hi All,
    I need a help in a query to convert a row to multiple row.
    I have two tables
    TableA
    ID1 attribute1_Name attribute1_code
    ID1 attribute2_Name attribute2_code
    ID2 attribute1_Name attribute1_code
    ID2 attribute2_Name attribute2_code
    ID2 attribute3_Name attribute3_code
    ID4 attribute1_Name attribute1_code
    ID4 attribute2_Name attribute2_code
    ID4 attribute3_Name attribute3_code
    ID4 attribute4_Name attribute4_code
    attribute name and attribute code can vary 1 to n for different id
    let's one ID has maximum no of codes 20 , then TableB will have columns like (EMP ID attribuute_code1 attribuute_code2 .... attribuute_code20)
    in TableB all the columns named attribuute_code1 ..attribuute_code20 will have value for those attribute
    TableB ( )
    Column EMP ID attribuute_code1 attribuute_code2 attribuute_code3 attribuute_code4
    EMP1 ID1 attribute1_value attribute2_value null null
    EMP2 ID1 attribute1_value attribute2_value attribute3_value null
    EMP3 ID2 attribute1_value attribute2_value attribute3_value attribute4_value
    EMP and ID is composite p.k
    My resulting table should have
    EMP1 ID1 attribute1_value
    EMP1 ID1 attribute2_value
    EMP2 ID1 attribute1_value
    EMP2 ID1 attribute2_value
    EMP2 ID1 attribute3_value
    EMP3 ID2 attribute1_value
    EMP3 ID2 attribute2_value
    EMP3 ID2 attribute3_value
    EMP3 ID2 attribute4_value
    Thanks in advance ...

    hi ,
    i am using oracle 10g
    i tried the way u said , but i'm getting few uncecessary rows .
    here i am giving u the example script
    for table_A
    create table TABLE_A
    ID VARCHAR2(50),
    ATTRIBUTE_NAME VARCHAR2(50),
    ATTRIBUTE_CODE VARCHAR2(50)
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID1', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID1', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute3_Name', 'attribute3_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute3_Name', 'attribute3_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute4_Name', 'attribute4_code');
    for table_b
    create table TABLE_B
    EMP_NAME VARCHAR2(40),
    ID VARCHAR2(50),
    ATTRIBUTE1_VALUE NUMBER,
    ATTRIBUTE2_VALUE NUMBER,
    ATTRIBUTE3_VALUE NUMBER,
    ATTRIBUTE4_VALUE NUMBER
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP1', 'ID1', 10, 20, null, null);
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP2', 'ID1', 30, 40, 50, null);
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP3', 'ID2', 60, 70, 80, 90);
    resulting table data shud come like: let it be table_c
    create table TABLE_C
    EMP_NAME VARCHAR2(50),
    ID VARCHAR2(50),
    ATTRIBUTE_CODE VARCHAR2(50),
    ATTRIBUTE_VALUE NUMBER
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP1', 'ID1', 'attribute1_code', 10);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP1', 'ID1', 'attribute2_code', 20);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute1_code', 30);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute2_code', 40);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute3_code', 50);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute1_code', 60);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute2_code', 70);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute3_code', 80);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute4_code', 90);
    thanx

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • I need to divide selected row into multiple rows when i navigate  ADF 11g

    Hi
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I need to divide selected row into multiple rows when i navigate to other page . Scenario - in first page i'm displaying some records with columns like empno , empstatus , empworkdepts ,curdepts
    Here empworkdepts gives the numeric number like no of departments work shifts 3 or 4 or 5. when i select any particular employee and fire next button to navigate next page.I have to divide the selected employee with same information into multiple times based on the empworkdepts value.
    empno empstatus empworkdepts curdept
    001 eds 2 TS
    002 hr 1 FO
    003 eds 4 TS
    *004 eds 3 TS*
    now i selected employee 004 , when i navigate to next page.
    Empno EmpStatus EmpWorkDepts CurDept
    004 eds 3 TS
    004 eds 3 TS
    004 eds 3 TS
    i did with java code in bean .but not stable .
    any help............
    thanks advance.............
    Edited by: user9010551 on May 5, 2010 10:48 PM
    Edited by: user9010551 on May 10, 2010 11:31 PM

    user9086775 wrote:
    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product     Sub Product          Name    Age
    New Car    Nissan                   Tom        49
    New Car    Nissan                   Jack         36
    Old Car      Audi                     Sam         24
    Old Car      Jaguar                  Pint          26
    Old Car      Audi                     Smith       41
    I need to be able to fetch the above data in the below fashion
    Product     Sub Product          Name    Age
    New Car
    Nissan
    Tom        49
    Jack        36
    Old Car     
    Audi            
    Sam        24
    Smith      41
    Jaguar                   Pint         26Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
    For example if you are in SQL Plus you can use the BREAK command.

  • Split single row into multiple rows containing time periods

    Hi,
    I have a table with rows like this:
    id, intime, outtime
    1, 2010-01-01 00:10, 2010-01-3 20:00
    I would like to split this row into multiple rows, 1 for each 24hr period in the record.
    i.e. The above should translate into:
    id, starttime, endtime, period
    1, 2010-01-01 00:10, 2010-01-02 00:10, 1
    1, 2010-01-02 00:10, 2010-01-03 00:10, 2
    1, 2010-01-03 00:10, 2010-01-03 20:00, 3
    The first starttime should be the intime and the last endtime should be the outtime.
    Is there a way to do this without hard-coding the 24hr periods?
    Thanks,
    Dan Scott
    http://danieljamesscott.org

    Thanks for all the feedback, Dan.
    It appears that the respective solutions provided will give you: a) different resultsets and b) different performance.
    Regarding your 'truly desired resultset' you haven't answered all questions from my previous post (there are differences in the provided examples), but anyway:
    I found that using CEIL or ROUND makes quite a difference, using my 'simple 3 record testset' (30 records vs. 66 records got initially returned, that's less than half of the original). That's quite a difference. However, I must call it a day (since it's almost midnight) for now, so there's room for more optimizement and I haven't thoroughly tested.
    But this might hopefully make a difference performancewise when compared to my previous 'dreaded example':
    SQL> drop table t;
    Table dropped.
    SQL> create table  t as
      2  select 1 id, to_date('2010-01-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-01-03 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      3  select 2 id, to_date('2010-02-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-02-05 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      4  select 3 id, to_date('2010-03-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-03-03 00:10', 'yyyy-mm-dd hh24:mi') outtime from dual;
    Table created.
    SQL> select id
      2  ,      max(intime)+level-1 starttime
      3  ,      case
      4           when level = to_char(max(t.outtime), 'dd')
      5           then max(t.outtime)
      6           else max(t.intime)+level
      7         end outtime
      8  ,      level period      
      9  from   t
    10  connect by level <= round(outtime-intime)
    11  group by id, level
    12  order by 1,2;
            ID STARTTIME           OUTTIME                 PERIOD
             1 01-01-2010 00:10:00 02-01-2010 00:10:00          1
             1 02-01-2010 00:10:00 03-01-2010 00:10:00          2
             1 03-01-2010 00:10:00 03-01-2010 20:00:00          3
             2 01-02-2010 00:10:00 02-02-2010 00:10:00          1
             2 02-02-2010 00:10:00 03-02-2010 00:10:00          2
             2 03-02-2010 00:10:00 04-02-2010 00:10:00          3
             2 04-02-2010 00:10:00 05-02-2010 00:10:00          4
             2 05-02-2010 00:10:00 05-02-2010 20:00:00          5
             3 01-03-2010 00:10:00 02-03-2010 00:10:00          1
             3 02-03-2010 00:10:00 03-03-2010 00:10:00          2
    10 rows selected.
    SQL> By the way: I'm assuming you're on 10g, is that correct?
    Can you give us some information regarding the indexes present on your table?

  • Urgent: How to break 1 Row into Multiple Rows

    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product Sub Product Name Age
    New Car Nissan Tom 49
    New Car Nissan Jack 36
    Old Car Audi Sam 24
    Old Car Jaguar Pint 26
    Old Car Audi Smith 41
    I need to be able to fetch the above data in the below fashion
    Product Sub Product Name Age
    New Car
    Nissan
    Tom 49
    Jack 36
    Old Car
    Audi
    Sam 24
    Smith 41
    Jaguar Pint 26
    Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!

    user9086775 wrote:
    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product     Sub Product          Name    Age
    New Car    Nissan                   Tom        49
    New Car    Nissan                   Jack         36
    Old Car      Audi                     Sam         24
    Old Car      Jaguar                  Pint          26
    Old Car      Audi                     Smith       41
    I need to be able to fetch the above data in the below fashion
    Product     Sub Product          Name    Age
    New Car
    Nissan
    Tom        49
    Jack        36
    Old Car     
    Audi            
    Sam        24
    Smith      41
    Jaguar                   Pint         26Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
    For example if you are in SQL Plus you can use the BREAK command.

  • Rows to multiple rows

    Hi Tom,
    Table having huge volume of data and want to split single row to multiple rows.I mean split based on acc1 and id1
    ex:
    SELECT acc1,id1,acc2, id2 FROM TGDW_ACCT
    acc1 id1 acc2 id2
    6000161114 002 6000251684 001
    6000161115 001 6000251687 004
    Expecting o/p
    acc1 id1
    6000161114 002
    6000251684 001
    6000161115 001
    6000251687 004
    Thanks and Regards,
    MR

    Hi,
    drop table DENEME2;
    create table DENEME2 (acc1 number,id1 VARCHAR2(10),acc2 number,id2 VARCHAR2(10));
    BEGIN
    INSERT INTO DENEME2 VALUES ('6000161114','002','6000251684','001');
    INSERT INTO DENEME2 VALUES ('6000161115','001','6000251687','004');
    COMMIT;
    END;
    UYGULAMA@XE> SELECT ACC1,ID1 FROM DENEME2
    2 UNION ALL
    3 SELECT ACC2,ID2 FROM DENEME2;
    ACC1 ID1
    6000161114 002
    6000161115 001
    6000251684 001
    6000251687 004

  • SSISB Row Counts in SQL Server 2012

    Does SSISDB (SQL Server 2012) track row counts such as total rows loaded, inserted rows, and updated rows?
    Or do we still need to use the row count transformation to capture these counts?
    Ryan P. Casey • <a href="http://www.R-P-C-Group.com">www.R-P-C-Group.com</a>

    Hi RPCASEY001,
    Based on my research, Row Counts for Execute SQL Task do not get captured in [SSISDB].[internal].[execution_data_statistics] table even when logging on the SSISDB server is set to Verbose. As per my understanding, this makes sense that how would SSIS know
    what the affected row counts are by the SQL statement in an Execute SQL Task given that we can put whatever we want in there?
    If we want to capture row counts loaded using the Execute SQL task, we can create a log table and add the row counts column into the log table. For more details, please refer to the following blog:
    http://consultingblogs.emc.com/jamiethomson/archive/2005/06/11/SSIS_3A00_-Custom-Logging-Using-Event-Handlers.aspx
    The following similar thread is for your reference:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/64ab1ec3-b0f2-4bba-9523-a7bcd6c154f1/ssis-logging-recording-record-count-from-sql-task?forum=sqlintegrationservices
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • There was an error trying to get the status of the job. 1: The server returned an error processing CloseJob: Stack empty.

    Hi
    While trying to perform the operation 'Annul All Below' in DRM 11.1.2.1, I received the following error: There was an error trying to get the status of the job. 1: The server returned an error processing CloseJob: Stack empty.
    Has anyone seen this error before, and does anyone know what the fix is?
    Thanks,

    Just giving my view on this.
    When you try to restore a Version backup file, you get this error.
    This is a known defect.  The problem is caused by missing values in properties like AddedOn, AddedBy, which may occur when a version is copied with 'Clear Changed Properties' selected.
    this is a known bug
    but to workaround - Blend the affected version into a new, empty version, which will populate the 'ChangedOn' properties. You can then back up this version and it will restore.
    Thanks,
    ~KKT~

  • Share Data Source between multiple report projects in Microsoft SQL Server 2012 Reporting Services

    I have a reports solution in 2012 which contains multiple report projects one each for target deployment folder and we use TFS 2012 for report deployment.
    We have a template project which has a bunch of template reports and all the datasources used in different reports.
    When I develop a report, I cannot "Preview" in TFS but, for deploy this used to work fine util the reports solution was in TFS 2010 & Visual Studio 2008 R2. Since we moved to TFS 2012 & SSRS 2012 not being able to deploy till I create all
    the necessary datasources for each project and now all the developers complaining that they cannot develop reports in TFS itself as they cannot preview (this problem was existing previously) and now not being able to deploy as it errors for each report "Could
    not find specified rds file". I tried messing around with the .rptproj file DataSources tag that did not help either by modifying it like below.
    <DataSources>
    <ProjectItem>
    <Name>DB.rds</Name>
    <FullPath>Template\Data Source\DB.rds</FullPath>
    </ProjectItem>
    </DataSources>
    Is there a way I could share a Data Source between multiple projects in Microsoft SQL Server 2012 Reporting Services?
    Thanks in advance.............
    Ione

    Hi ione721,
    According to your description, you want to create a shared data source which works for multiple projects. Right?
    In Reporting Services, A shared data source is a set of data source connection properties that can be referenced by multiple reports, models, and data-driven subscriptions that run on a Reporting Services report server. It must be within one project.
    We can't specify one data source working for multple projects. In this scenario, we suggest you put those reports into one project. Otherwise you can only create one data source for each project.
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

Maybe you are looking for

  • Acrobat PDF Toolbar in Internet Explorer 7 Disappears

    I have the Adobe Acrobat Web PDF Converter addin on IE7 under WinXP Pro. The toolbar for the function appears normally when I am browsing in the first tab. If I open another tab for browsing, the PDF toolbar disappears. It is listed in View/Toolbars,

  • Using Cue Points to advance to next scene

    I'm pretty new to AS3. I'm a designer trying to do it myself. What I'm trying to do is use a cue point at the end of my FLV (which is loaded using ui loader in my flvSWF) to go to the next scene in my mainSWF file. here's the code I'm using in my flv

  • Problem with User-defined function

    Does anyone know how to make the user-efined functionto return a object. We know how to run a java class within cal script and pass the result to that java class. However, what we need is to be able to return the result in the form of a java class wi

  • SSAS Date Dimension attribute not displaying all members when browsed singly

    I have an SSAS Cube database that holds data from 2009 to 2013 (5 years) There is a Date Dimension in the database which holds a "Calender Period" Hierarchy with the attributes CalenderYear >> Quarter >> MonthYear >> Day . I am connecting to the cube

  • How to convert decimal notation to comma notation

    Hi Folks, I have an issue in converting decimal notation to comma notation for France. I have changed the decimal notation in SU01 from 123.4 to 123,4 but when i run some custom program written by me it is extracting output as 123.4 than 123,4. So i