Code
declare @txtDept varchar(500)
set @txtDept ='*Len77777777777s*'
DECLARE @deptName_L2 varchar(50)
select @deptName_L2= stuff(@txtDept,1,1,'')
--select CHARINDEX('*',@txtDept)
--select CHARINDEX('*',@deptName_L2)
IF(CHARINDEX('*',@txtDept)=1 AND CHARINDEX('*',@deptName_L2)=LEN(@txtDept)-1) --*在第一个位置 和最后
BEGIN
DECLARE @deptName_f varchar(50),@deptName_L1 varchar(50)
-- SET @deptName='*EE三DDDDDDD厂QQQ*'
select @deptName_f= stuff(@txtDept,LEN(@txtDept),1,'')
select @deptName_L1= stuff(@deptName_f,1,1,'')
-- SET @strWhile=' AND DEPARTNAME LIKE ''%'+@deptName_L1+'%'''
END
print @deptName_L1
posted @
2009-11-14 11:47
wj-conquer
阅读(
297)
评论()
编辑
收藏
举报