小编Ari*_*ick的帖子

ODBC SQL 查询的 Julia ReadOnlyMemoryError

我正在编写一个查询 SQL 数据库的函数,但遇到了一个 ReadOnlyMemoryError() ,这让我很困惑。问题是,当我将代码作为简单脚本运行时,一切都会按预期运行。但是当我尝试将完全相同的代码包装在函数中时,我得到了 ReadOnlyMemoryError()。

这是我的代码的脚本版本:

using ODBC
using DBInterface
using Dates
using DataFrames

server = "server string "
username = "username "
password = " password"
db = " db name"

start_date=Nothing
end_date=Nothing

if start_date == Nothing || typeof(start_date) != "Date"
    start_date = Dates.today() - Dates.Day(30)
end

if end_date == Nothing || typeof(end_date) != "Date"
    end_date = Dates.today()
end

query = """ SQL SELECT statement """

connect_string = "DRIVER={ODBC Driver 17 for SQL Server};SERVER=" * server *
                ";DATABASE=" …
Run Code Online (Sandbox Code Playgroud)

sql odbc function julia

3
推荐指数
1
解决办法
254
查看次数

标签 统计

function ×1

julia ×1

odbc ×1

sql ×1