Forum Replies Created

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

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

    jkalmar 43328 (8/26/2014)


    Luis Cazares (8/26/2014)


    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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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

    )

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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