Linqer不会执行此SQL. [英] Linqer won't do this SQL.. :(

查看:90
本文介绍了Linqer不会执行此SQL.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个快速查询,但是由于我的表名为User(SQL关键字),Linqer(从SQL到LINQ的转换器)无法转换SQL查询.

I have this quick query but since my table is named User (SQL keyword), Linqer (a SQL to LINQ converter) fails to convert the SQL query.

这是查询:

SELECT TOP (100) PERCENT
  dbo.[User].OID,
  dbo.[User].FirstName + ' ' + dbo.[User].LastName AS [User Name],
  COUNT(dbo.AssignedCounty.OID) AS [Counties Assigned],
  dbo.UserType.Name AS [User Type]
FROM
  dbo.UserType
  INNER JOIN dbo.[User] ON dbo.UserType.OID = dbo.[User].UserTypeID
  LEFT OUTER JOIN dbo.AssignedCounty ON dbo.[User].OID = dbo.AssignedCounty.UserID
GROUP BY
  dbo.[User].OID,
  dbo.[User].FirstName + ' ' + dbo.[User].LastName,
  dbo.UserType.Name,
  dbo.[USER].IsActive
HAVING
  (dbo.[User].IsActive = 1)
ORDER BY
  [User Name]

有人可以指导我如何解决此问题吗?我需要LINQ.

Can anyone guide me on how to work my way around this? I need the LINQ.

推荐答案

显然,使用关键字作为表/列名称是一个非常不好的习惯.一个或多个用户是SQL Server中的关键字.此外,联接混杂在一起,Linqer或SQL Metal无法处理它们,但是,LinqPad能够理解查询,但由于它不是转换工具,因此对我不利.我终于进行了一次重命名操作,大多数失败的查询才再次开始工作.用户-> SystemUser

Apparently, using keywords as Table/Column names is a very bad habit. The User/Users is a keyword in SQL Server. In addition, the joins are jumbled up and Linqer or SQL Metal cannot process them however, LinqPad was able to understand the query but since it is not a conversion tool, does me no good. I finally did a massive renaming operation and most of my failing queries just started to work again. User -> SystemUser

这篇关于Linqer不会执行此SQL.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆