Forum Replies Created

Viewing 15 posts - 5,911 through 5,925 (of 8,731 total)

  • RE: Need to Copy a Master Record and its detail records

    For a single row, you can use SCOPE_IDENTITY().

    For multiple rows (or a single row if you wish), you can use the OUTPUT clause.

    Do you need more help?

  • RE: View or Function not updateable error with DELETE and CTEs

    I guess there's a misunderstanding.

    You want to delete rows from PL1 when the data is in PL2.

    You can't delete rows from a query, you delete rows from a table.

    Should I...

  • RE: Finding first and repeated values

    Something like this?

    WITH CTE AS(

    SELECT *, ROW_NUMBER() OVER(PARTITION BY FirstVisit ORDER BY ScheduledEnd) rn

    FROM #Visits

    )

    SELECT OpportunityID,

    ActivityID,

    ...

  • RE: View or Function not updateable error with DELETE and CTEs

    Actually, the code is trying to delete PL2 instead of PL1.

    PL2 is not updateable, so you can delete from it.

  • RE: Transpose... But not as you know it ????? Table Data Restructure / Summarise

    This might not be better, but it's different. 😉

    SELECT NHS_NUMBER_ANON,

    NHS_NUMBER,

    MIN(MonthDate) Doctor_Start_Period,

    MAX(MonthDate) Doctor_End_Period,

    Value Doctor_Code

    FROM PS_Table

    CROSS...

  • RE: Text Function alternative in SQL

    As Gail said, SQL Server won't show an error like that. SSIS might do that and you should specify that because the syntax is completely different.

    If the number goes over...

  • RE: Rows into Columns - remove duplicates and variable rows

    One option is to use group by inside your ctePreAgg, the other is to change ROW_NUMBER to DENSE_RANK.

  • RE: PIVOT

    Hardy21 (8/26/2014)


    Luis Cazares (8/25/2014)


    jshahan (8/25/2014)


    sestell1 (8/25/2014)


    Does anyone actually use the PIVOT operator?

    I find it so limited that I almost always roll my own using GROUP BY and CASE.

    I like PIVOT...

  • RE: PIVOT

    jshahan (8/25/2014)


    Luis Cazares (8/25/2014)


    jshahan (8/25/2014)


    sestell1 (8/25/2014)


    Does anyone actually use the PIVOT operator?

    I find it so limited that I almost always roll my own using GROUP BY and CASE.

    I like PIVOT...

  • RE: PIVOT

    jshahan (8/25/2014)


    sestell1 (8/25/2014)


    Does anyone actually use the PIVOT operator?

    I find it so limited that I almost always roll my own using GROUP BY and CASE.

    I like PIVOT because you can...

  • RE: Stuck on Query to Conditionally Exclude Data

    Here's an extended set of sample data and the solutions posted. I guess Micky's got the correct formula.

    CREATE TABLE PRE_LOAD(

    KitID varchar(20) NULL,

    BatteryID varchar(20) NULL,

    TestID varchar(20) NULL,

    LBSTAT varchar(8) NULL

    )

    INSERT INTO PRE_LOAD

    ...

  • RE: Search and Find in SSIS?

    If you want to look in a single package, you can right click on the package (inside BIDS) and select "View Code". That will show the xml and you can...

  • RE: Stuck on Query to Conditionally Exclude Data

    According to what I understood, this should work:

    select *

    from PRE_LOAD ex

    where EXISTS

    (

    select 1

    from PRE_LOAD i

    where LBSTAT <> 'NOT DONE'

    AND ex.kitID = i.KitID

    )

  • RE: Table creation policies. Is this silly or is it just me?

    The sad reality is that "very controlled, monitored and process oriented system" is just a nice wish as there are many things that just get into production and haven't been...

  • RE: PIVOT

    sestell1 (8/25/2014)


    Does anyone actually use the PIVOT operator?

    I find it so limited that I almost always roll my own using GROUP BY and CASE.

    Lots of people come to the forums...

Viewing 15 posts - 5,911 through 5,925 (of 8,731 total)