Viewing 15 posts - 1 through 15 (of 17 total)
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
March 28, 2024 at 4:08 pm
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
(
...
March 27, 2024 at 7:53 am
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...
January 30, 2023 at 5:23 pm
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...
January 23, 2023 at 10:32 am
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
March 26, 2021 at 12:53 pm
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...
November 13, 2015 at 9:13 am
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...
May 19, 2015 at 8:02 am
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...
May 19, 2015 at 6:32 am
Yes, i think i must use CTE, and subtract somehow from next/previous record.
But i don't know how
May 19, 2015 at 6:14 am
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...
May 19, 2015 at 4:51 am
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...
March 24, 2014 at 6:43 am
ok thanks.
Do you have a small example for create resource group ? can i add database to this reource group ?
March 24, 2014 at 5:24 am
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 !...
January 30, 2014 at 12:48 pm
Wow ! works perfectly, great solution.
Amazing
Thank's Luis !
January 30, 2014 at 9:10 am
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...
April 27, 2010 at 3:19 am
Viewing 15 posts - 1 through 15 (of 17 total)