RODBC错误:执行sqlSave时无法SQLExecDirect'CREATE TABLE ... [英] RODBC ERROR: Could not SQLExecDirect 'CREATE TABLE ... when doing sqlSave

查看:68
本文介绍了RODBC错误:执行sqlSave时无法SQLExecDirect'CREATE TABLE ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是个简短的故事,谈论设置非常重要,我正在使用RODBC和FreeTDS连接到SQL Azure数据库.请记住,这是SQL Azure数据库(也恰好是内部SQL Server的问题,这使我感到震惊,将其发布在此处以寻求帮助或了解真正的问题).首先,它在没有集群密钥或密钥的情况下不能很好地与数据库配合使用,因此需要做的是addPK = T或更高版本的addPK = TRUE

Here is the short story, and it is important to talk about the setup, I’m using RODBC and FreeTDS to connect to the SQL Azure database. Remember it is SQL Azure database (also happen to be issue for on premise SQL Server, that alarm me to post it here to ask for help or understand the real issue). First, it does not play nice with the database without a cluster key, or a key, so what need to do is addPK = T or longer version addPK = TRUE

解决方案#1.两步法

这将有助于创建正确的表结构,但是仍然会使您失望.不用担心现在我们要做的就是添加数据

This will help create the proper table structure, however it’ll still fail you. Don’t worry. Now what we need to do is to append the data

sqlSave(ch, USArrests, addPK = T)

它将告诉您错误,然后您下一步需要添加数据

It will tell you the error, then what you need to do next is to append the data

sqlSave(ch, USArrests, tablename = ‘USArrests’, append = T)

现在您准备向冰雹或欢呼声欢呼吗?!

Now you ready to hail or shout hurray?!

解决方案2.

那不是我,我很懒,应该在一个命令中完成

That is not me, I’m lazy, it should be done in one command

该解决方案似乎没有任何意义,这是更好的版本

That solution does not seem to be making sense, here is the better version

sqlSave(ch, cust, tablename="dbo.customers", safer=F, addPK=T)

更安全= F可解决问题.不知道这是来自FreeTDS还是RODBC sqlSave函数的错误.

Safer = F does the trick. not sure if this is the bug from FreeTDS or RODBC sqlSave function.

http://tiggeranddraggon.tumblr.com/post/98707948606/the-unintuitive-could-not-sqlexecdirect-rodbc-error-and

推荐答案

最后,我找到了答案,这可能是如此明显- USE http://www.microsoft.com/zh-cn/download/details.aspx?id=36437

Finally, I found the answer, which might be so obvious - USE Microsoft SQL Server ODBC Driver for Linuxhttp://www.microsoft.com/en-us/download/details.aspx?id=36437

这篇关于RODBC错误:执行sqlSave时无法SQLExecDirect'CREATE TABLE ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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