February 5, 2009 at 2:48 am
The following code must return a row number of the selected Project, the id2 (Parameter) is the ID of the selected Project.
The query is working correct under SQL Server 2005 but not on the compact version.
I get this error:
There was an error parsing the query. [ Token line number = 1,Token line offset = 10,Token in error = SELECT ]
Can someone help me find a correct solution.
SELECT
(
SELECT COUNT (*) FROM
(
SELECT
Project.id AS id ,
Project.name AS name
FROM Project
WHERE
(Project.id = @id OR @id IS NULL )
AND ( Project.name LIKE '%'+ @name + '%' OR @name IS NULL )
) Temp1
WHERE
((Temp2.name > Temp1.name))
) AS SORT_ORDER
FROM
(SELECT
Project.id AS id ,
Project.name AS name
FROM Project
WHERE
( Project.id = @id OR @id IS NULL )
AND ( Project.name LIKE '%'+ @name + '%' OR @name IS NULL )
) Temp2
WHERE (Temp2.id = @id2)
February 5, 2009 at 7:10 am
Can you post the DDL and sample data so we can possibly try to duplicate the error and test any solution?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
February 5, 2009 at 9:15 am
An example is added in attatchment.
Example:
A Listbox is populated from Database on Window_Loaded.
When ListboxItem is clicked -> the Guid of the selected object is used in a Query, to get the current position (in the database) of the selected row.
In the Query a Subselect is used and throws an error in SQL CE (Compact).
Can someone help me with a good solution.
PS: SQL Server 2005 Compact Edition must be installed (v3.5 SP1)
April 2, 2009 at 9:06 am
This is one of the many things we cannot do in SQL Server CE. Nested SELECTs are legal in SQL Server (including Express), but not in SSCE.
April 29, 2009 at 6:44 am
is there any other way of reaching the same result for:
ex:
SELECT rs1, rs2, (select count(*) from table2) FROM TABLE1
?
Thanks
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply