sp_executesql invalid object name
2024-08-31 16:26:54
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.
最新文章
- scala - multiple overloaded alternatives of method bar define default arguments
- LA 4329 Ping pong 树状数组
- java的三大框架(三)---Hibernate
- php SimpleXML 例子
- 知方可补不足~row_number,rank,dense_rank,ntile排名函数的用法
- iOS 采用个推时,未收到推送消息,测试DeviceToken无效
- 安卓App流量统计
- 【转】iOS超全开源框架、项目和学习资料汇总
- IOS CALayer(一)
- 自定义的 ListBoxItem 自适应ListBox的宽度
- Android IOS WebRTC 音视频开发总结(三七)-- 台湾help
- 分布式缓存BeIT Memcached简介
- 【转】Android 使用Scroller实现绚丽的ListView左右滑动删除Item效果
- setsockopt()使用方法()参数说明
- 终于了解了User-Agent的历史了
- NancyFX 第四章 Nancy快速上手 (使用Nancy模板)
- Error Code: 1044. Access denied for user 'root'@'%' to database
- 【Android Studio安装部署系列】十九、Android studio使用SVN
- Servlet学习1
- php开发工具,zendstudio13使用方法补丁