CNCEC_SUBQHSE_WUHUAN/DataBase/版本日志/SGGLDB_WH_V2025-02-11-xiaj.sql

37 lines
1.7 KiB
Transact-SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


Alter table PreRun_SubInspectTerm
alter column PropertyTechnologyId varchar(max)
Alter table PreRun_SubInspectTermItem
alter column PropertyTechnologyId varchar(max)
GO
ALTER Function [dbo].[StrToTable](@str varchar(max))
Returns @tableName Table
(
Id varchar(50)
)
As
--该函数用于把一个用逗号分隔的多个数据字符串变成一个表的一列,例如字符串'1,2,3,4,5' 将编程一个表
--佘春生于2017.12.20
Begin
set @str = @str+','
Declare @insertStr varchar(100) --截取后的第一个字符串
Declare @newstr varchar(max) --截取第一个字符串后剩余的字符串
set @insertStr = left(@str,charindex(',',@str)-1)
set @newstr = stuff(@str,1,charindex(',',@str),'')
Insert @tableName Values(@insertStr)
while(len(@newstr)>0)
begin
set @insertStr = left(@newstr,charindex(',',@newstr)-1)
Insert @tableName Values(@insertStr)
set @newstr = stuff(@newstr,1,charindex(',',@newstr),'')
end
Return
END
GO