Forum Replies Created

Viewing 15 posts - 1 through 15 (of 17 total)

  • Reply To: Help for "complex" group by Query

    Wow! on the example data it seems to work, now I'll try on many other data that I have here locally.

    Thanks anyway, nice work

  • Reply To: Help for "complex" group by Query

    Thank you all for your help, and please excuse my English. I'll try to explain the logic with the attached image and other example

     

    INSERT #Passaggi
    (
    ...
    Attachments:
    You must be logged in to view attached files.
  • Reply To: Safa Insert

    Thank you for your anwser.

    After some searching i found the error

    I use this statement

    INSERT INTO Passaggi(Code, DataPassaggio, idServizio)

    SELECT @Code, @DataPassaggio, @idServizio

    WHERE NOT EXISTS (SELECT Code FROM Passaggi WITH(UPDLOCK, HOLDLOCK) WHERE...

  • Reply To: Safa Insert

    Violazione del vincolo PRIMARY KEY 'PK_Passaggi'. Impossibile inserire la chiave duplicata nell'oggetto 'dbo.Passaggi'. Valore della chiave duplicata: (yz4zmt, 262, 2023-01-23 09:51:14)

    In english is "Violation of PRIMARY KEY constraint 'PK_Passaggi'. Could...

  • Reply To: must be drop table ?

    Thanks Grant, i know the problems with using the cursors. It was my last choice.

    Maybe in a next post I will explain the problem of obtaining data via query.

    thanks

     

  • RE: Delete and update

    i think it works

    ;With UpdateData As

    (

    SELECT idRgp, idTipologiaCard, OrdRgp, (ROW_NUMBER() OVER (PARTITION BY idTipologiaCard ORDER BY ordrgp) -1) AS Ordinamento FROM OrdinamentiRgpPerCard

    WHERE idTipologiaCard IN (SELECT idTipologiaCard FROM OrdinamentiRgpPerCard...

  • RE: Check recordset

    yes you're right, depends on order by.

    In my real case, i don't have table exacly like this, and i don't have primary Key.

    Only have Dt1, and Dt2

    for explan my problem...

  • RE: Check recordset

    i think this is works

    ;WITH CTE AS (

    SELECT

    rownum = ROW_NUMBER() OVER (ORDER BY p.dt1),

    p.Dt1,p.Dt2

    FROM Intervalli p

    )

    SELECT

    CTE.dt1, CTE.Dt2,

    nex.dt1 Ndt1,

    nex.dt2 NDt2

    FROM CTE

    LEFT JOIN CTE prev ON prev.rownum = CTE.rownum - 1

    LEFT JOIN...

  • RE: Check recordset

    Yes, i think i must use CTE, and subtract somehow from next/previous record.

    But i don't know how

  • RE: Check recordset

    thanks but i want to check entire recordset.

    i'am sure that dt2 > dt1 for each record

    but i need to chech if dt1 of OTHER RECORD is inside to ANOTHER RECORD

    and...

  • RE: database priority

    ok thank's to everybody. I'll read some documentation about that, but i suppose that's not a good way to solve.

    "Implementing it is not a 5 minute job." i know...

  • RE: database priority

    ok thanks.

    Do you have a small example for create resource group ? can i add database to this reource group ?

  • RE: split range from table

    thank's Luis, cte is "the key" for this problem.

    you have found a clever method to subtract ROW_NUMBER() from "numero" 🙂

    after this, it's easy.

    I've used a few times cte

    thank's !...

  • RE: split range from table

    Wow ! works perfectly, great solution.

    Amazing

    Thank's Luis !

  • RE: Help for query, pivot technique

    ColdCoffee (4/27/2010)


    Alessandro, Sei il benvenuto!

    Grazie ! 🙂

    @Gianluca Sartori, wow ! great work, i know FOR XML PATH('') is "magic" for situation like this.

    OK is very clear now, i don't like...

Viewing 15 posts - 1 through 15 (of 17 total)