我正在尝试使用批量插入将电子邮件通信导入数据库表,但我似乎无法保留 CR 和 LF 字符。让我们考虑以下几点:
CREATE TABLE myTable (
Email_Id int,
Email_subject varchar(200) NULL,
Email_Body TEXT NULL
)
批量插入语句具有以下内容:
codepage = '1250',
fieldterminator = '<3P4>',
rowterminator = '<3ND>',
datafiletype = 'char'
该文件包含完整的电子邮件(包括 CR 和 LF 字符)。我想导入数据并包含 CR 和 LF 字符。我读过 BULK INSERT 将每个条目视为单行,但这是否意味着它会去除 CR 和 LF 字符?如果是这样,我可以使用什么来导入此 CSV 文件?我无权访问 SSIS,我更愿意使用 SQL 代码来执行此操作。
示例数据:
11324<3P4>Read this email because it's urgent<3P4>Haha John,
I lied, the email was just to mess with you!
Your Nemesis,
Steve
P.S. I still hate you!
<3ND>
11355<3P4>THIS IS THE LAST STRAW<3P4>Steve,
I have had it with you stupid jokes, this email is going to the manager.
Good day,
John
<3ND>