This is a discussion on BUG within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> Why does this crash SQL7 with SP4 and latest MDAC? CREATE TABLE #test ( [year] smallint, [month] tinyint, [product] ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Why does this crash SQL7 with SP4 and latest MDAC? CREATE TABLE #test ( [year] smallint, [month] tinyint, [product] varchar(100), [value] money ) GO INSERT INTO #test VALUES (2000, 2, 'p-01', 1.00) INSERT INTO #test VALUES (2000, 2, 'p-02', 2.00) INSERT INTO #test VALUES (2001, 2, 'p-01', 1.00) INSERT INTO #test VALUES (2001, 2, 'p-03', 3.00) INSERT INTO #test VALUES (2002, 2, 'p-01', 1.00) INSERT INTO #test VALUES (2002, 2, 'p-01', 1.00) GO SELECT a.year, a.product, a.month, ISNULL(o.value, 0) value, ISNULL((SELECT SUM(value) FROM #test WHERE year=a.year AND product=a.product AND month<=a.month), 0) cumul_artikel, ISNULL((SELECT SUM(value) FROM #test WHERE year=a.year AND month=a.month), 0) value_month, ISNULL((SELECT SUM(value) FROM #test WHERE year=a.year AND month<=a.month), 0) cumul_month FROM (SELECT j.year, j.product, m.month FROM (SELECT DISTINCT [year], [product] FROM #test) j, (SELECT 1 AS [month] UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12) m) AS a LEFT OUTER JOIN #test o ON o.year = a.year AND o.month=a.month AND o.product=a.product GO DROP TABLE #test GO |
| |||
| Yes, it does work on SQL2000, but crashes SQL7. And I need it to run on SQL7 <anonymous@discussions.microsoft.com> wrote in message news:577f01c480e8$49111200$a401280a@phx.gbl... > Work's fine on my SQL2000 & Query analizer > Any errors messages? How do you run the code? > Maybe the string is too long? |
| ||||
| Could you please post the error numbers and error messages you get when you run this? Could you also post any additional errors you have in the SQL log when you run this? -Sue On Fri, 13 Aug 2004 05:56:16 +0200, "Lisa Pearlson" <no@spam.plz> wrote: >Yes, it does work on SQL2000, but crashes SQL7. >And I need it to run on SQL7 > ><anonymous@discussions.microsoft.com> wrote in message >news:577f01c480e8$49111200$a401280a@phx.gbl... >> Work's fine on my SQL2000 & Query analizer >> Any errors messages? How do you run the code? >> Maybe the string is too long? > |