SQL Server 到 MySQL - 但如何使用存储过程呢?

发布于 2024-08-23 04:24:47 字数 418 浏览 5 评论 0原文

我的任务是将 SQL Server 数据库转换为 MySQL 5.* 数据库。 我觉得自己已经充分了解了数据类型之间的转换。

然而,我读到 MySQL 使用 ANSI,而不是 T-SQL,并且不支持游标。 我的问题是,我应该如何处理我的所有 SQL Server 函数和存储过程(其中一些使用游标)

我想“以正确的方式进行操作” ”。

我是否将它们全部移动到像 SqlCommand cmd = new SqlCommand("SELECT * FROM ...", con"); 这样的代码,我是否将它们移动到 MySQL 的 procedure-things,我应该尝试 jQuery,或 LINQ,或...?

前端仍将使用 ASP.NET,但我们有可能将其重写/移动到 PHP。

I have been tasked with converting a SQL Server database into a MySQL 5.* database.
I feel well-read up about converting between datatypes.

However, I read that MySQL does ANSI, not T-SQL, and doesn't support cursors.
My question is, what am I supposed to do with all of my SQL Server functions and sprocs (some of which use cursors) ?

I want to "do it the right way" .

Do I move them all to code like SqlCommand cmd = new SqlCommand("SELECT * FROM ...", con");, do I move them to MySQL's procedure-things, should I try jQuery, or LINQ, or ... ?

The front end will be in ASP.NET still, but there is a possibility we might rewrite/move it to PHP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

残疾 2024-08-30 04:24:48

我不认为 jQuery 会有帮助,但如果您转向 LINQ,您可能可以完全不用 SPROCS。自从我开始使用 LINQ 作为我的(轻量级)ORM 以来,我很少使用 SPOC。

I don't think jQuery is going to help, but you may be able to do without the SPROCS entirely if you move to LINQ. Since I started using LINQ as my (lightweight) ORM, I rarely use an SPROC.

隱形的亼 2024-08-30 04:24:48

如果游标是您的大难题,您可以在没有游标的情况下循环:

SQL Server 游标参考(语法等)

MySql 有一个 WHILE 循环:

http://dev.mysql.com/doc/refman/5.0/en/while-statement.html

只需选择 MIN(PK) 并循环遍历集合 SELECTing MIN(PK) >满足 WHERE 子句的 currentPK。

if cursors are your big hang-up, you can loop without a cursor:

SQL Server Cursor Reference (Syntax, etc)

MySql has a WHILE loop:

http://dev.mysql.com/doc/refman/5.0/en/while-statement.html

just select the MIN(PK) and loop over the set SELECTing the MIN(PK)>currentPK that meets your WHERE clause.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文