我已经创建了一个存储过程,但我现在无法改变它,因为这个问题仍在使用中。
alter proc GetDuplicates @search1 varchar(40) = '', @search2 varchar(40) =
'blahblehblargh' as
select distinct i4202 "Man", i4203 "Mod"
into #ManModTemp
from inventory
where i4211 like ('2%')
order by i4202 desc
select distinct i4202 "Man", i4203 "Mod", count(*) "Count"
into #ManModCount
from inventory
group by i4202, i4203
select Man, Mod
into #ManModList
from #ManModTemp
where Mod in (select Mod from #ManModList group by Mod having Count(*) >
1) and (Man like '%' + IsNull(@search1,'') + '%' or Man like '%' +
IsNull(@search2, 'blahblehblargh') + '%')
select * from #ManModList
join #ManModCount
on (#ManModList.Man = #ManModCount.Man and #ManModList.Mod =
#ManModCount.Mod)
我认为我犯的错误可能是我没有将它包装在BEGIN-END语句中,现在它还没有结束?
请原谅hacky代码(正如我的妻子,开发人员所说的那样)。我是新来的?
这是错误:
Could not execute statement.
Procedure in use by 'user'
SQLCODE=-215, ODBC 3 State="40001"
Line 1, column 1