CreateFUNCTIONdbo.fu_GetPhoneNamesByOfficeID(@OfficeIDint)RETURNSvarchar(250)ASBEGINdeclare@Strvarchar(250),@PhoneNamevarchar(50),@isFirstbitselect@Str=''set@isFirst=0dec...
Create FUNCTION dbo.fu_GetPhoneNamesByOfficeID ( @OfficeID int ) RETURNS varchar(250) AS BEGIN declare @Str varchar(250), @PhoneName varchar(50), @isFirst bit select @Str='' set @isFirst=0 declare name_cur cursor scroll for select p.手机品牌+ ' ' + p.手机型号 from TB_BAS_Office_Model m inner join phoneInfo p on p.flngID=m.flngPhoneID and m.flngOfficeID=@OfficeID order by p.手机品牌, p.flngID desc open name_cur fetch name_cur into @PhoneName while @@fetch_status = 0 begin if @isFirst=0 begin set @isFirst=1 select @Str=@Str + @PhoneName end else begin select @Str=@Str + ',' + @PhoneName end fetch next from name_cur into @PhoneName end close name_cur deallocate name_cur -- 返回值 return @Str End ------------------------------------------------------------------------------------------------- 上面的是 sqlserver 的自定义函数 我现在需要把他迁移到mysql 表数据已经好了 就这个函数么迁移呢 格式语法怎么做 谁可以帮帮我
展开