我有以下功能,
CREATE FUNCTION [dbo].[Split](@String varchar(8000), @Delimiter char(1))
returns @temptable TABLE (items varchar(8000))
as
begin
set @String = RTRIM(LTRIM(@String))
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null return
while @idx!= 0
begin
set @idx = charindex(@Delimiter,@String)
if @idx!=0
set @slice = left(@String,@idx - 1)
else
set @slice = @String
if(len(@slice)>0)
insert into @temptable(Items) values(@slice)
set @String = right(@String,len(@String) - @idx)
if len(@String) = 0 break
end
return
end
在服务器1中它工作正常,但在服务器2中它显示错误,
if(len(@slice)>0)
insert into @temptable(Items) values(@slice)
Msg 207, Level 16, State 1, Procedure Split, Line 21
Invalid column name 'Items'.
修改:我运行了sp_server_info
,发现server1 IDENTIFIER_CASE = MIXED
和server2 IDENTIFIER_CASE = SENSITIVE
,还有server1 COLLATION_SEQ = charset=iso_1 sort_order=nocase_iso charset_num=1 sort_order_num=52
和server2 COLLATION_SEQ = charset=cp437 sort_order=bin_cp437 charset_num=3 sort_order_num=30