我在使用SQL Server 2008r2在SQL中使用LOWER时出现问题我认为我对使用较低的内容有误解,我总是得到相同的错误','
附近的语法不正确INSERT INTO [ch-s-0008180].HolidayTracker.dbo.HtUser(FirstName,LastName,Email,UserName,AdAccount,AdDomain)
SELECT u1.firstName,u1.lastName,u1.email,'CH'+(LOWER(LEFT(u1.firstName,2))+(LOWER(LEFT(u1.lastName,3)),'EUROPE\'+(LOWER(LEFT(u1.firstName,2))+(LOWER(LEFT(u1.lastName,3)),''
FROM HolidayTracker.dbo.HTUser u1
LEFT JOIN HolidayTracker.dbo.HtUser u2 ON u1.firstName = u2.FirstName AND u1.lastName = u2.LastName AND u1.email = u2.Email
感谢您的帮助和快速回答
答案 0 :(得分:3)
(
之前你还有LOWER
。这是修改过的查询。
INSERT INTO [ch-s-0008180].HolidayTracker.dbo.HtUser(FirstName,LastName,Email,UserName,AdAccount,AdDomain)
SELECT u1.firstName,
u1.lastName,
u1.email,
'CH' + LOWER(LEFT(u1.firstName,2)) + LOWER(LEFT(u1.lastName,3)),
'EUROPE\' + LOWER(LEFT(u1.firstName,2)) + LOWER(LEFT(u1.lastName,3)),
''
FROM HolidayTracker.dbo.HTUser u1
LEFT JOIN HolidayTracker.dbo.HtUser u2
ON u1.firstName = u2.FirstName AND
u1.lastName = u2.LastName AND
u1.email = u2.Email
代码的颜色混乱了。 \
中的EUROPE
无法逃脱'
答案 1 :(得分:0)
您没有正确关闭支架。
'CH'+(LOWER ...,'' FROM