Handling Quotation when Inserting Table to SQL Database
1 次查看(过去 30 天)
显示 更早的评论
I have a table that looks like this:
id = [1 2]';
name = {'abc', 'a''bc'}';
data = table(id,name);
disp(data)

Now when I tried to insert this table to a MS SQL database, I got this error:
hdr = {'id','name'};
insert(conn, 'userName.dbName.tableName', hdr, data)

Apparently it's because of the single quotation mark in the second row of the table, as I can see the first row got inserted successfully.
Thoughts?
2 个评论
Kojiro Saito
2018-6-13
I cannot reproduce this issue in MATLAB R2018a with SQL Server 2016. Which MATLAB and SQL Server versions are you using?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!