Author |
Topic |
kdnichols
Posting Yak Master
232 Posts |
Posted - 2007-02-15 : 12:56:22
|
Hello,I am getting a Incorrect syntax near the word group in this clause.from Parser_ocr Inner Join Parser_ojb on order_no_ocr = order_no_ojb Inner JOIN RGV_Codes on substring (compl_cde_ojb, 1, 3) = CODE Inner JOIN csg.hist_sbb_Base on hse_key_ocr = hse_key_sbbwhere substring (compl_cde_ojb, 16, 3) = CODEand ir_tech_ojb between 950 and 999and compl_dte_ojb BETWEEN '&low' AND '&high'and prin_ocr = 8600GROUP BY ir_tech_ojb, substring (compl_cde_ojb, 16, 3),compl_dte_ojb,DES, res_name_sbb, ADDR1_HSE,job_typ_ojb, job_class_ojb, order_no_ocr, ls_chg_op_id_ocr, CommissionAUT)group by rollup(TECHN, RESCODE,(COMPLET, DESCRIPTION, NAME, ADDRESS, JOB, TYP, NUMB, OPR))order by 1, 2,3, 5; What do I need to fix?Thanks,Kurt |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 13:15:17
|
GROUP BY ... WITH ROLLUPThere are lot of good books for ORACLE programmers who wants to go T-SQL.Peter LarssonHelsingborg, Sweden |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-15 : 13:34:57
|
order by 1, 2,3, 5;This is no longer allowed in SQL Server 2005 (compatibility mode of 90).Tara Kizer |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 14:33:32
|
[code]select compatibility_level from sys.databaseswhere name = 'test'--90SELECT @@VERSION--Microsoft SQL Server 2005 - 9.00.3033.00 (Intel X86) Dec 6 2006 17:53:12 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)DECLARE @Test TABLE (c VARCHAR, d VARCHAR)INSERT @TestSELECT 'c', 'q' UNION ALLSELECT 'b', 'w' UNION ALLSELECT 'a', 'e' UNION ALLSELECT 'c', 'h'select * From @test order by 1, 2OUTPUTp1 p2------ ------a eb wc hc q[/code]Peter LarssonHelsingborg, Sweden |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-15 : 14:41:56
|
I wonder why it fails for us then in our stored procedures for 2 projects. SQL Server Books Online for 2005 also indicates that it will fail. Developers had to change a bunch of stored procedures in order to get them to work on 90.Tara Kizer |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 14:45:07
|
May it changed back with SP2?Peter LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 14:47:13
|
Taken from SQL Server 2005 Books Online (SP2)quote: order_by_expression Specifies a column on which to sort. A sort column can be specified as a name or column alias, or a nonnegative integer representing the position of the name or alias in the select list. An integer cannot be specified when the order_by_expression appears in a ranking function. A sort column can include an expression, but when the database is in SQL Server 2005 (90) compatibility mode the expression cannot resolve to a constant. Column names and aliases can be qualified by the table or view name. In SQL Server 2005, qualified column names and aliases are resolved to columns listed in the FROM clause. If order_by_expression is not qualified, the value must be unique among all columns listed in the SELECT statement.Multiple sort columns can be specified. The sequence of the sort columns in the ORDER BY clause defines the organization of the sorted result set.The ORDER BY clause can include items that do not appear in the select list. However, if SELECT DISTINCT is specified, or if the statement contains a GROUP BY clause, or if the SELECT statement contains a UNION operator, the sort columns must appear in the select list. Additionally, when the SELECT statement includes a UNION operator, the column names or column aliases must be those specified in the first select list.
Peter LarssonHelsingborg, Sweden |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-15 : 15:11:06
|
Isn't SP2 still in Beta?My BOL (SP1) indicates the same thing as yours. Perhaps we were running the RTM version when we got all of the errors. I did not reverify BOL for my last post, I was going on memory of when we got the errors. They all had to do with the ordinal numbers in the ORDER BY. I don't recall the exact specifics of the queries though as this was quite a few months ago. They may have had derived tables in them.Tara Kizer |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 15:18:29
|
There are so many "editions" of service packs right now, so I don't know what it is, more than the official Community Technology Preview (CTP).A list of fixes made in this is available herehttp://support.microsoft.com/kb/921896/The top reason I upgraded was that I were annoyed by having to connect and login for every new query window I started.Peter LarssonHelsingborg, Sweden |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 15:18:59
|
And there is both EDIT and DESIGN menu alternatives on the database context popup menu!Peter LarssonHelsingborg, Sweden |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-15 : 15:23:10
|
quote: Originally posted by Peso The top reason I upgraded was that I were annoyed by having to connect and login for every new query window I started.
I hate that too! I'm glad to hear that it is fixed.Tara Kizer |
 |
|
kdnichols
Posting Yak Master
232 Posts |
Posted - 2007-02-16 : 09:45:26
|
Hello,This is really cool to see everyone put there heads together to find solutions for each other!That is what I like about this forum.Thanks everyone!Kurt |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|