sql动态查询和静态查询之间的确切区别是什么? [英] What is the exact difference between sql dynamic query and static query ?

查看:517
本文介绍了sql动态查询和静态查询之间的确切区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好在我的新项目中使用动态和静态sql(内部过程)。但我还是不知道有什么区别?

Dynamic sql有什么用?这两种情况我们都是从前端传递参数然后为什么这个dyanmic查询?

哪里可以使用?

Hi in my new project we are using dynamic and static sql (inside procedure). but still i dont know what is the difference?
What is the use of Dynamic sql? Both case we are passing parameters from front end then why this dyanmic query ?
where is the use?

推荐答案

静态查询在调用代码的安全上下文(存储过程,函数等),动态查询与用户访问权限一起运行。



当你不要使用动态查询时知道确切的sql,例如你可能在运行时更改列或where子句等。
Static queries run within the security context of the calling code (stored procedure, function etc.), dynamic queries run with the users access permissions.

Dynamic queries are used when you don''t know the exact sql, for example when you might change columns or where clauses etc. at runtime.


这篇关于sql动态查询和静态查询之间的确切区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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