SQL查询仅返回1行#1
select * from email_table
where emailAddress like '%'+char(13)+'%'
在SQL 2008中需要带回车符返回前两行。
答案 0 :(得分:0)
您应该能够在SQL中直接添加一个新行:
select *
from @email_table
where emailAddress like '%
%'
答案 1 :(得分:0)
您可以执行以下操作来排除故障:
/*DECLARE @email_table TABLE (emailaddress varchar(2000))
INSERT INTO @email_table(emailaddress) SELECT '#1gmail.com ' + CHAR(13) + CHAR(10)
INSERT INTO @email_table(emailaddress) SELECT '#2gmail.com' + CHAR(13) + CHAR(10)
INSERT INTO @email_table(emailaddress) SELECT '#3gmail.com'
*/
SELECT *,CONVERT(VARBINARY(MAX),emailaddress) AS [Binary Representation]
FROM @email_table
--WHERE emailAddress LIKE '%' + CHAR(13) + '%'
[Binary Representation]行的最后一个字符应为0D0A(如果EmailAddress字段为NVARCHAR,则为0D000A00),如果不是,则look up它们实际上是什么字符。