声明两个with是以,分割就可以了
ALTER PROCEDURE [dbo].[sp_getDrOfmoduleCodeTrace]
(
@vob nvarchar(255),
@version nvarchar(255)
)
AS
BEGIN
SET NOCOUNT ON;
-- +-split-+代表的是换行符
set @vob = replace(@vob,'+-split-+',char(10));
--程序传过来的vob是分隔符是/,而数据库中vob分隔符是\
set @vob = replace(@vob,'/','\');
print @vob;
DECLARE @RunSQL nvarchar(MAX);
--统计表
declare @mctTable varchar(255);
--link表
declare @linkTable varchar(255);
declare @StoryTable varchar(255);
declare @RMTable varchar(255);
set @mctTable = 'E3_MODULE_STATISTIC_' + @version;
set @linkTable = 'E3_LINK_' + @version;
set @StoryTable = 'IKNOW_STORY_' + @version;
set @RMTable = 'IKNOW_RMPUBLISHTREE_' + @version;
--如果所需要的表不存在,则存储过程结束
IF not EXISTS (SELECT * FROM sysobjects WHERE name = @mctTable)
return;
else if not EXISTS (SELECT * FROM sysobjects WHERE name = @linkTable)
return;
else if not EXISTS (SELECT * FROM sysobjects WHERE name = @StoryTable)
return;
set @RunSQL = '
with vob
as
(
select distinct realvob from E3_MODULE_STATISTIC_U2000V1R8C00
where vob = ''' + @vob + '''
),
dr_code
as
(
select distinct drcode from ' + @StoryTable + ' a
inner join ' + @RMTable + ' b
on a.drcode = b.rmid
where jirakey in
(
select distinct destid from ' + @linkTable + ' a
where DESTTYPE=''STORY'' and
exists(
select * from vob b
where a.SOURCEID like b.realvob + ''%''
)
) and drcode !='''''
+ ')
select ITEMGUID as id,name,tdtname,creator,CREATIONDATE as createddate,''DR'' as type,''' + @version + ''' as version from ' + @RMTable + '
where rmid in(select * from dr_code)';
EXECUTE SP_EXECUTESQL @RunSQL;
END
分享到:
相关推荐
- 首先,你需要在你的Flink项目中添加`flink-connector-sqlserver-cdc_2.11-2.3.0`依赖。这可以通过Maven或Gradle的依赖管理来完成。 - 接着,配置连接器以指向你的SQL Server实例,包括服务器地址、端口、数据库...
- JRE7:Java 7(JRE7)是Oracle在2011年发布的版本,引入了一些新特性,比如try-with-resources语句,用于自动关闭资源,增强了switch语句等。 - JRE8:Java 8(JRE8)于2014年发布,引入了lambda表达式、函数式...
在SQL Server中,字符串处理是数据库管理中不可或缺的一部分,它涉及到对文本数据的提取、修改、比较和格式化。本文将深入探讨SQL Server中的主要字符串函数,帮助你更好地理解和运用这些功能。 1. **LEFT** 和 **...
- 配置:`./configure --with-tdsver=7.4 --enable-msdblib --enable-sybase-compat` - 编译:`make` - 安装:`sudo make install` 2. **unixODBC**: unixODBC是Linux下的一个ODBC管理器,它提供了一个标准...
在实际开发中,为了处理异常和资源管理,通常会使用try-with-resources语句,并考虑使用PreparedStatement以提高性能和安全性。同时,随着SQL Server版本的更新,微软也发布了更现代的驱动,例如适用于SQL Server ...
Microsoft SQL Server Management Studio Express(SSMSE)是一种免费、易于使用的图形管理工具,用于管理SQL Server 2005 Express Edition和SQL Server 2005 ExpressEdition with Advanced Services。注意:SSMSE ...
R is one of the most popular, powerful data analytics languages and environments in use ...concepts are explained in case you are not familiar with SQL Server, as is often the case with data scientists.
Beginning Transact-SQL with SQL Server 2000 and 2005 byPaul TurleyandDan Wood Wrox Press 2006 (594 pages) ISBN:076457955X Prepare for the ever-increasing demands of programming....
Flink1.14.4自定义flink-connector-jdbc连接SQLServer和SAP数据库
Expert SQL Server In-Memory OLTP is a deep dive into one of the most significant features of SQL Server 2014 – support for In-Memory Online Transaction Processing. The book describes the architecture...
SQLserver CTE With 使用with产出临时表,在根据临时表二次查询
根据提供的文件内容,本篇知识点解析将围绕Microsoft SQL Server 2012中Querying(查询)相关的知识点展开,这是MCSA(微软认证解决方案专家)SQL Server认证考试70-461的培训套件内容。以下将详细说明标题和描述中...
同时,SQL Server 2019还引入了Always Encrypted with Enclave Support,增强了密钥保护。 5. **PolyBase**:扩展了对Hadoop和Azure Blob Storage的数据源支持,使得查询多源数据更加方便。 6. **SQL Server on ...
The SQL Server client tools must be installed on your desktop computer and the SQL Server relational database server must be installed on either your desktop computer or on a remote server with ...
### SQL Server 存储过程 With Encryption 加密的解密方法 #### 背景与目的 在SQL Server中,为了保护存储过程中的敏感代码或逻辑,可以使用`WITH ENCRYPTION`选项对存储过程进行加密处理。这可以有效防止未经授权...
通常,使用`try-with-resources`语句可以简化这个过程: ```java try (Connection conn = DriverManager.getConnection(url, username, password); Statement stmt = conn.createStatement()) { // SQL操作... ...
解决方法:打开‘程序’-‘所有程序’-‘Microsoft SQL Server 2008’-‘配置工具’-‘SQL Server 配置管理器’,在弹出的窗体中,找到‘SQL Server 2008 网络配置’,把‘MSSQLSERVER 的协议’下的“Named ...