常用存储过程1(获取字符串中的第一个数值)create proc GetFirstNum
常用存储过程1(获取字符串中的第一个数值) 
@str nvarchar(200),
常用存储过程1(获取字符串中的第一个数值) 
@num int output
常用存储过程1(获取字符串中的第一个数值)
as
常用存储过程1(获取字符串中的第一个数值) 
declare @i int,@numchar varchar(8)
常用存储过程1(获取字符串中的第一个数值) 
set @i=0
常用存储过程1(获取字符串中的第一个数值) 
set @numchar=''
常用存储过程1(获取字符串中的第一个数值) 
常用存储过程1(获取字符串中的第一个数值) 
while @i<=len(@str)
常用存储过程1(获取字符串中的第一个数值) 
begin
常用存储过程1(获取字符串中的第一个数值)  
declare @c char
常用存储过程1(获取字符串中的第一个数值)  
set @c=substring(@str,@i,1)
常用存储过程1(获取字符串中的第一个数值)  
if @c>='0' and @c<='9'
常用存储过程1(获取字符串中的第一个数值)   
set @numchar=@numchar+@c
常用存储过程1(获取字符串中的第一个数值)  
else
常用存储过程1(获取字符串中的第一个数值)   
if len(@numchar)>0
常用存储过程1(获取字符串中的第一个数值)    
break
常用存储过程1(获取字符串中的第一个数值)  
set @i=@i+1
常用存储过程1(获取字符串中的第一个数值) 
end
常用存储过程1(获取字符串中的第一个数值) 
常用存储过程1(获取字符串中的第一个数值) 
set @num=cast(@numchar as int)
常用存储过程1(获取字符串中的第一个数值)
go
常用存储过程1(获取字符串中的第一个数值)
常用存储过程1(获取字符串中的第一个数值)
declare @num int
常用存储过程1(获取字符串中的第一个数值)
exec GetFirstNum 'hh1234f',@num out
常用存储过程1(获取字符串中的第一个数值)
select @num
常用存储过程1(获取字符串中的第一个数值)

相关文章:

  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
相关资源
相似解决方案