Viewing 15 posts - 1,156 through 1,170 (of 1,957 total)
try this...
First some set up - your data - next time please do this for us...
IF OBJECT_ID('tempdb..#cnums') IS NULL
BEGIN
CREATE TABLE #cnums(Cnum bigint,D1 int, D2 int,D3 int, D4 int)
INSERT #cnums
SELECT 121345,11,12,NULL,NULL...
October 3, 2012 at 4:22 pm
That does seem very slow for that number of rows - if you post the execution plan (de-sensitise it if you need to), maybe we can spot the problem?
October 3, 2012 at 12:07 pm
Thanks for the feedback,
That's not too bad, but that still sounds slow - how much data is in your groups and items tables?
Are they indexed on gleaderid and id respectively?
Can...
October 3, 2012 at 9:32 am
Michael T2 (10/3/2012)
October 3, 2012 at 7:21 am
Dwain,
I did have a read of some of the Swedish districts thread, but not in that much detail.
I guess the general approach with these multi-level recursion problems is to reduce...
October 3, 2012 at 5:53 am
Thanks for the validation dwain, and having read your thread, I thought that Jeff's preference for the WHILE loop must have some mileage, so I tried to speed things up...
October 3, 2012 at 3:31 am
There are two solutions to this amount:
2172,2173,2174, 2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187, 2189,2190,2191
2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190
I have formatted them like that to highlight the differences.
The query is damn ugly...
October 2, 2012 at 6:42 pm
I have turned your sample data into something that people can use - take note that you should do this , not us...
Things to note:
1. I used two CTE expressions...
October 2, 2012 at 6:10 pm
It's really hard to give a decent answer without any sample data.
How about you provide some sample data and expected results and you will definitely get a decent answer 🙂
October 2, 2012 at 4:58 pm
Yes, I agree - I might look into this, I am writing an addin at the moment and that would be great.
I don't know if it is possible, but I...
October 1, 2012 at 5:15 am
This is one way to go...
select min(class) as class,x.nc1, x.nc2
from #nc
cross apply (select case when nc1<nc2 then nc1 else nc2 end,case when nc1<nc2 then nc2 else nc1 end) x(nc1,nc2)
group...
October 1, 2012 at 4:38 am
<disclaimer> I don't even want to think about the security implications of what you are doing, so I will leave that to you</disclaimer>
Have you thought about using sqlcmd instead of...
October 1, 2012 at 3:58 am
dwain.c (10/1/2012)
Don't use "status." Use an expiry timestamp instead. Then use that when you query to see whether the entry has expired.
+1 😀
October 1, 2012 at 3:52 am
here you go...any questions, just ask.
DECLARE @xml XML = '
<row id="PDPD1134200001" xml:space="preserve">
<c2>100113</c2>
<c3>KHR</c3>
<c4>1</c4>
<c5>TR</c5>
<c6>00</c6>
<c7>1</c7>
<c8>21050</c8>
<c9>B</c9>
<c10>10049</c10>
<c11>72.00</c11>
<c13>0</c13>
<c14>21050</c14>
<c15>9700.01</c15>
<c16>9700.01</c16>
<c17>-50000</c17>
<c18>50000</c18>
<c19>50000</c19>
<c20>0</c20>
<c21>IN</c21>
<c21 m="2">PR</c21>
<c21 m="3">PE</c21>
<c21 m="4">PS</c21>
<c22>0</c22>
<c22 m="2">50000</c22>
<c22 m="3">0</c22>
<c22 m="4">0</c22>
<c24>20111208</c24>
<c25>50000</c25>
<c26>0</c26>
<c27>100000</c27>
<c28>IN</c28>
<c28 m="1" s="2">PR</c28>
<c28 m="1" s="3">PE</c28>
<c28 m="1" s="4">PS</c28>
<c29>10000</c29>
<c29 m="1" s="2">90000</c29>
<c29 m="1" s="3">0</c29>
<c29 m="1" s="4">0</c29>
<c30>0</c30>
<c30...
September 30, 2012 at 4:51 am
Viewing 15 posts - 1,156 through 1,170 (of 1,957 total)