Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:45:29+00:00 2026-05-31T02:45:29+00:00

I am running my query using WebMatrix, I think it is correct, however I

  • 0

I am running my query using WebMatrix, I think it is correct, however I am getting an error.

My query is as follows :

   var result = db.Query(
                @"SELECT e.event_id, e.title, e.description, e.event_start, e.event_end, e.group_id, e.recurring
                FROM   event e
                JOIN   Membership m ON m.GroupID = e.group_id
                WHERE  e.recurring = 0
                AND    m.UserID = @0
                AND    e.event_start >= @1
                AND    e.event_end <= @2
                UNION ALL
                SELECT e.event_id, e.title, e.description, DATEADD(week, w.weeks, e.event_start), DATEADD(week, w.weeks, e.event_end), e.group_id, e.recurring
                FROM   event e
               JOIN   Membership m ON m.GroupID = e.group_id
               CROSS JOIN 
                ( SELECT  row_number() OVER (ORDER BY Object_ID) AS weeks
                  FROM SYS.OBJECTS
                ) AS w
                WHERE  e.recurring = 1
                AND    m.user_id = 4;
                AND    e.event_start >= @4
                AND    e.event_end <= @5", userID, start, end, userID, start, end
            );

The error is :

System.Data.SqlServerCe.SqlCeException (0x80004005): There was an
error parsing the query. [ Token line number = 10,Token line offset =
38,Token in error = OVER ] at
System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) at
System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()

I’m holding query in a .cs file. I’m told I should create a stored procedure since SQL Server compact may not support the OVER function, is this correct? How can I create a stored procedure for this query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:45:30+00:00Added an answer on May 31, 2026 at 2:45 am

    After FROM, you can list multiple tables separated by comma’s, and the result will be a CROSS JOIN of all those tables.

    But you can’t use the comma syntax after a JOIN. Instead, write out the CROSS JOIN:

    JOIN   Membership m 
    ON     m.GroupID = e.group_id
    CROSS JOIN 
           (
           SELECT  row_number() OVER (ORDER BY Object_ID) AS weeks
           FROM SYS.OBJECTS
           ) AS w
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a code which calls an SQL query using ODBCDataReader. The result of
I am running this query using CakePHP: $total = $this->Lapse->query(select sum(unix_timestamp(stop) - unix_timestamp(start)) from
I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class
I'm running a database query to load a dropdownbox using jquery. Is there a
I'm having trouble running a complex query against our company LDAP server. I'm using
I'm running a batch file command on a server which is using reg query
When using GetModuleFileNameEx to query the image path of a running process, some processes
I am running a query using Linq2SQL that comes down to following query: DateTime?
I am running hive query using get_json_object to read json strings from files in
I'm running a query using EXEC sp_helptext Object, but it returns multiple lines with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.