这个存储过程怎么传值啊?

nitaiyoucala nitaiyoucala 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

CREATE PROCEDURE [dbo].[Up_Pretreatment_registerNo]
@status nvarchar(50) output,
@客户ID_OutPut nvarchar(50) output,
@strSQL nvarchar(max)
AS

select t1.工商注册号 as 导入工商注册号,
t1.联系电话 as 导入电话,
t1.客户名称 as 导入客户名称,
t1.联系人 as 导入联系人,
t1.备注 as 导入备注,
t2.工商注册号 as 库内工商注册号,
t2.客户ID as 库内客户ID,
t3.ph as 库内电话,
case when t2.客户ID is not null and t3.ph is not null then 0 when t2.客户ID is not null and t3.ph is null then 1
when t2.客户ID is null then 2 end as 状态
from (
这里放@strSQL会报错?怎么解决啊?
) t1
left join pre_database t2 on t1.工商注册号=t2.工商注册号
left join pre_database_phone t3 on t2.客户ID=t3.客户ID and t3.ph=t1.联系电话
group by t1.工商注册号,t1.联系电话,t2.工商注册号,t3.ph,t2.客户ID,t1.客户名称,t1.联系人,t1.备注,
case when t2.客户ID is not null and t3.ph is not null then 0 when t2.客户ID is not null and t3.ph is null then 1
when t2.客户ID is null then 2 end


@strSQL 的值是:
select '310115000987594' 工商注册号,'021-63523522' 联系电话,'上海百度' 客户名称,'杜成刚' 联系人,'哈哈我是备注' 备注
union select '310115000987594' 工商注册号,'153434312101010' 联系电话,'腾讯' 客户名称,'李四' 联系人,'我啊啊' 备注
union select '310115000987593' 工商注册号,'021-5975505' 联系电话,'北京新浪' 客户名称,'张三' 联系人,'没有啊' 备注
union select '3100007432121233343' 工商注册号,'13886448928' 联系电话,'中软国际' 客户名称,'王五' 联系人,'呵呵' 备注
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
nitaiyoucala
MS-SQL Server 34,876 成员 254,635 内容