sp_executesql invalid object name
You are doing it wrong!
Try:
exec(@SQL)
instead of:
EXECUTE sp_executesql @SQL
To use sp_executesql
the variable must be inside @SessionID
the quotes and it must be provided has input parameter. Check this for a full example!
You've to be aware that Dynamic SQL is a good port for SQL injections!
The temp table is out of scope after exec is done.'exec' or 'sp_executesql' are run in thier own scope.
Thus anything created like temp tables and variables are destroyed or out of scope as soon as execution is over .Think these like stored proc.
To fix the issue.Create the temp table in main code.. then insert into it using dynmic sql and then read it in main code.
sp_executesql invalid object name的更多相关文章
- Recompile the invalid object for oracle.
1. How does the invalid object come? The Oracle database will invalidate objects if a dependent obje ...
- Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)
http://blogs.msdn.com/b/ramaprasanna/archive/2009/09/16/invalid-object-name-sys-configurations-micro ...
- MacTex XeLaTex xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object. 报错的解决方法
在使用MacTex配合TexStudio编译beamer的时候,爆出如下错误, xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object. 结果尝试其 ...
- Oracle EBS 重新编译无效对象 invalid object
1. 查看数据库中的无效对象 check oracle object SQL> select count(*) from dba_objects where status= ...
- sql - Invalid object name 'dbo.in$'
这是我从excel导入的表,用查询的时候,不加前面部分的'dbo',能查出来,好像是owner的原因吧.
- oracle impdp ORA-02304 invalid object identifier literal
reference: https://webgeest.blogspot.com/2015/07/ora-39083-ora-02304-on-impdp-datapump.html 解决方法 ...
- 讨论贴:在sp_executesql 中生成的临时表的可见性
首先创建数据表 IF object_id('TestTable') IS NOT NULL DROP TABLE TestTable GO ,),Info )) GO INSERT TestTable ...
- EXEC sp_executesql with multiple parameters
传递多个参数 https://stackoverflow.com/questions/28481189/exec-sp-executesql-with-multiple-parameters http ...
- [terry笔记]IMPDP报错ORA-39083 Object type TYPE failed to create ORA-02304
今天在使用impdp导入的时候(同一数据库中转换schema),遇到了 ORA-39083: Object type TYPE failed to create with error: ORA-023 ...
随机推荐
- Redis学习总结(3)——Redis整合Spring结合使用缓存实例
摘要:本文介绍了如何在Spring中配置redis,并通过Spring中AOP的思想,将缓存的方法切入到有需要进入缓存的类或方法前面. 一.Redis介绍 什么是Redis? redis是一个key- ...
- 为什么不能往Android的Application对象里存储数据
在一个App里面总有一些数据需要在多个地方用到.这些数据可能是一个 session token,一次费时计算的结果等.通常为了避免activity之间传递对象的开销 ,这些数据一般都会保存到持久化存储 ...
- hdoj Let the Balloon Rise
/*Let the Balloon Rise Problem Description Contest time again! How excited it is to see balloons ...
- STL_算法_查找算法(binary_search、includes)
C++ Primer 学习中.. . 简单记录下我的学习过程 (代码为主) 全部容器适用(O(log(n))) 已序区间查找算法 binary_search //二分查 ...
- 13款用于拍摄全景照片的iOS应用
全景图是一种大画幅.用来展示尽量多的周围环境的照片,甚至能够展示一个球状的完整空间,让观赏者直接“站在”摄影师的位置,在照片里将该环境一览无余.全景照片能够以最直观的方式向人们展示和记录一个美丽风景的 ...
- 使用具体解释及源代码解析Android中的Adapter、BaseAdapter、ArrayAdapter、SimpleAdapter和SimpleCursorAdapter
Adapter相当于一个数据源,能够给AdapterView提供数据.并依据数据创建相应的UI.能够通过调用AdapterView的setAdapter方法使得AdapterView将Adapter作 ...
- 大海教你学手游2015CocosLua第一季_00课程介绍
话说大盘从5100直掉到3500点,千仅仅股票跌幅超过20%,跌跌不休.散户.证监会.做空机构開始斗气地主来了: 散户:叫地主 空头:抢地主,3分 证监会:pass 空头:压死 证监会:不要 散户:不 ...
- django 笔记13 CSRF
CSRF a. CSRF原理 b. 无CSRF时存在隐患 c. Form提交(CSRF) d. Ajax提交(CSRF) CSRF请求头 x-CSRFToken HTTP_X_CSRFToken dj ...
- spring boot整合mail
1.添加依赖 </dependency> <dependency> <groupId>org.springframework.boot</groupId> ...
- 基于python3-sklearn,Flask 的回归预测系统
看到一副图片挺有意思,放在片头 序 "傍晚小街路面上沁出微雨后的湿润,和煦的西风吹来,抬头看看天边的晚霞,嗯明天又是一个好天气.走到水果摊旁,挑了个根蒂蜷缩.敲起来声音浊响的青绿西瓜,一边满 ...