SQL server 在OPENQUERY中使用参数
2016-02-25 08:37
387 查看
DECLARE @Sql VARCHAR(1000)
DECLARE @TaskMonth VARCHAR(1000)
set @TaskMonth ='201602'
SET @Sql = 'select AREANO,STATIONNO,CHANNELNO,MEDIATYPE '
SET @Sql = @Sql+' FROM OPENQUERY(TEST, ''SELECT AREANO,STATIONNO,CHANNELNO,MEDIATYPE '
SET @Sql = @Sql+' FROM T_RECORDERPLAN where TASKMONTH = '''''+@TaskMonth+''''' '')'
print(@Sql)
EXEC(@Sql)
DECLARE @TaskMonth VARCHAR(1000)
set @TaskMonth ='201602'
SET @Sql = 'select AREANO,STATIONNO,CHANNELNO,MEDIATYPE '
SET @Sql = @Sql+' FROM OPENQUERY(TEST, ''SELECT AREANO,STATIONNO,CHANNELNO,MEDIATYPE '
SET @Sql = @Sql+' FROM T_RECORDERPLAN where TASKMONTH = '''''+@TaskMonth+''''' '')'
print(@Sql)
EXEC(@Sql)
相关文章推荐
- [leetcode] 128. Longest Consecutive Sequence 解题报告
- leetcode ---Unique Paths II
- HDU 3726 Graph and Queries
- Quick Sort
- [Locked] Binary Tree Longest Consecutive Sequence
- Arduino、arm、树莓派、单片机四者有什么不同?
- C# 集合类 :(Array、 Arraylist、List、Hashtable、Dictionary、Stack、Queue)
- 浅谈 easyui tabs 的href和content属性
- QSqlQuery::value: not positioned on a valid record
- Java break continue return 的区别
- easyUI 对话框的关闭事件
- UITableView 小节-备
- GitLab: Failed to authorize your Git request: inte
- [leetcode] Divide and Conquer
- iOS UITableView的使用大全-备用
- 设计模式:Builder模式(多个构造器参数时可显著改善可读性)
- dialog子线程操作UI异常:Only the original thread that created a view hierarchy can touch its views
- dialog子线程操作UI异常:Only the original thread that created a view hierarchy can touch its views
- WeUI 入门教程
- 传智播客168期JavaEE就业班(第十天 request response)