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

  • Home
  • SEARCH
  • 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 117923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:24:47+00:00 2026-05-11T03:24:47+00:00

I have a Linq to SQL query that was working just fine with SQL

  • 0

I have a Linq to SQL query that was working just fine with SQL Server 2005 but, I have to deploy the web app with a SQL Server 2000 and, when executing that query, I get his error:

‘System.Data.SqlClient.SqlException: The column prefix ‘t0′ does not match with a table name or alias name used in the query.’

I have more queries but it doesn’t seems to have problems with those. Now, this is the query:

from warningNotices in DBContext_Analyze.FARs where warningNotices.FAR_Area_ID == filter.WarningAreaID &&       warningNotices.FAR_Seq == filter.WarningSeq &&       warningNotices.FAR_Year == filter.WarningYear       orderby warningNotices.FAR_Seq ascending       select new Search_Result       {         FAR_Area_ID = warningNotices.FAR_Area_ID,         FAR_Seq = warningNotices.FAR_Seq,         FAR_Year = warningNotices.FAR_Year,         DateTime_Entered = (DateTime)warningNotices.DateTime_Entered == null ?   DateTime.MaxValue : (DateTime)warningNotices.DateTime_Entered,         Time_Entered = warningNotices.Time_Entered,         OrigDept = warningNotices.OrigDept,         Part_No = warningNotices.Part_No,         DateTime_Analyzed = (DateTime)warningNotices.DateTime_Analyzed == null ? DateTime.MaxValue : (DateTime)warningNotices.DateTime_Analyzed,         Analyzed_By = warningNotices.Analyzed_By,         MDR_Required = (Char)warningNotices.MDR_Required == null ? Char.MinValue : (Char)warningNotices.MDR_Required,         Resp_Dept = (from FARSympt in DBContext_Analyze.FAR_Symptoms                      where FARSympt.FAR_Area_ID == warningNotices.FAR_Area_ID &&                    FARSympt.FAR_Year == warningNotices.FAR_Year &&                    FARSympt.FAR_Seq == warningNotices.FAR_Seq                  select new { FARSympt.Resp_Dept}).FirstOrDefault().Resp_Dept,         Sympt_Desc = (from SymptomsCatalog in DBContext_Analyze.Symptoms               where SymptomsCatalog.symptom_ID == filter.Status_ID                   select new {                                         SymptomsCatalog.Sympt_Desc                                      }).FirstOrDefault().Sympt_Desc,         Status_ID = warningNotices.Status.HasValue ? warningNotices.Status.Value : 0         }; 

Previously I had a ‘Distinc’ in the subquery for the Resp_Dept field, but I removed it.

Any ideas? Thanks in advance for your comments =)


This is query I get from the SQL Server profiler:

exec sp_executesql N'SELECT [t0].[FAR_Seq], [t0].[FAR_Year],      (CASE          WHEN ([t0].[DateTime_Entered]) IS NULL THEN @p3         ELSE [t0].[DateTime_Entered]      END) AS [DateTime_Entered], [t0].[Time_Entered], [t0].[OrigDept], [t0].[Part_No],      (CASE          WHEN ([t0].[DateTime_Analyzed]) IS NULL THEN @p4         ELSE [t0].[DateTime_Analyzed]      END) AS [DateTime_Analyzed], [t0].[Analyzed_By],      (CASE          WHEN (UNICODE([t0].[MDR_Required])) IS NULL THEN @p5         ELSE CONVERT(NChar(1),[t0].[MDR_Required])      END) AS [MDR_Required], (     SELECT [t2].[Resp_Dept]     FROM (         **SELECT TOP (1)** [t1].[Resp_Dept]         FROM [dbo].[FAR_Symptoms] AS [t1]         WHERE (UNICODE([t1].[FAR_Area_ID]) = UNICODE([t0].[FAR_Area_ID])) AND ([t1].[FAR_Year] = [t0].[FAR_Year]) AND ([t1].[FAR_Seq]  = [t0].[FAR_Seq])         ) AS [t2]     ) AS [Resp_Dept], (     SELECT [t4].[Sympt_Desc]     FROM (         **SELECT TOP (1)** [t3].[Sympt_Desc]         FROM [dbo].[Symptoms] AS [t3]         WHERE [t3].[symptom_ID] = @p6         ) AS [t4]     ) AS [Sympt_Desc], [t0].[FAR_Area_ID],      (CASE          WHEN [t0].[Status] IS NOT NULL THEN [t0].[Status]         ELSE @p7      END) AS [Status_ID] FROM [dbo].[FARs] AS [t0] WHERE (UNICODE([t0].[FAR_Area_ID]) = @p0) AND ([t0].[FAR_Seq] = @p1) AND ([t0].[FAR_Year] = @p2) ORDER BY [t0].[FAR_Seq]',N'@p0 int,@p1 int,@p2 varchar(2),@p3 datetime,@p4 datetime,@p5 nchar(1),@p6 int,@p7  int',@p0=76,@p1=7204,@p2='08',@p3=''9999-12-31 23:59:59:997'',@p4=''9999-12-31 23:59:59:997'',@p5=N' ',@p6=0,@p7=0 

The only think that I see there that may not in SQL Server 2000 is the ‘()’ in the ‘Select top…’ but I’m not sure if that is what is causing the problem and, also, I don’t know how that could be fixed =S

Thanks again =)

  • 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. 2026-05-11T03:24:48+00:00Added an answer on May 11, 2026 at 3:24 am

    after several testing and review the DB, I found that the problem was a legacy table I was working on: that table has ‘text’ type fields. Also, I had to remove some ‘Distinct‘ instructions in a nested query I had.

    I found this and, after review that, I found that I have to change my queries and that the ‘Distinct’ instruction does not work correctly. As a side note, let me say that the nested queries can also generate unexpected behavior.

    So, the real lesson here is that if you need to deploy this against a SQL Server 2000, set an instance of the server and test against it!!! XD

    Thanks a lot of your help =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can do this easily using SSIS, you can refer… May 11, 2026 at 11:47 am
  • added an answer User-agent: * Disallow: / User-agent: Googlebot Allow: / User-agent: Slurp… May 11, 2026 at 11:47 am
  • added an answer PHP just cannot perform as fast as C, plain and… May 11, 2026 at 11:47 am

Related Questions

I have a Linq to SQL query that was working just fine with SQL
Strange performance outcome, I have a LINQ to SQL query which uses several let
I have a LINQ to SQL generated class with a readonly property: <Column(Name:=totalLogins, Storage:=_TotalLogins,
I have a LINQ-to-SQL DataContext that represents a parent-child relationship of Products to Prices.
I have a linq to sql database. Very simplified we have 3 tables, Projects
I have a working LINQ to SQL model. I want to be able to
I have a fairly standard inheritance situation in my current LINQ-to-SQL project. I have
I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access)
I have a table in the database that I'm retrieving using LINQ to SQL,
I have used LINQ to SQL with a update stored procedure to update databases

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.