Возможно, вы захотите попробовать SwisSQL Online инструмент миграции
Это дает следующий результат:
--SWISSQL DROP SCRIPTS
If Exists ( SELECT name
FROM sysobjects
WHERE name = 'yonetici_kontrol_musteri'
AND type = 'FN')
DROP FUNCTION yonetici_kontrol_musteri
GO
CREATE FUNCTION yonetici_kontrol_musteri
(
@p_ID_MUSTERI_SIRKET FLOAT ,
@p_ID_YONETICI FLOAT
)
RETURNS FLOAT
AS
BEGIN
DECLARE @adv_error INT
DECLARE @v_unvan FLOAT
DECLARE @v_yonetici FLOAT
DECLARE @v_tmp_unvan FLOAT
DECLARE @v_tmp_yonetici FLOAT
DECLARE @v_result FLOAT
SELECT @v_result = - 1
SELECT @v_unvan = id_unvan
FROM lu_yonetici
WHERE id_yonetici = @p_ID_YONETICI
SELECT @adv_error = @@ERROR
IF @adv_error != 0
BEGIN
GOTO Exception1
END
DECLARE cursor_for_inline_select1 CURSOR LOCAL FOR
SELECT
ISNULL(b.id_mufettis, 0) id_mufettis,
b.id_sef
FROM cr_rut_musteri c,
lu_bayi_temsilci b
WHERE c.id_musteri_sirket = @p_id_musteri_sirket
AND c.id_temsilci = b.id_temsilci
AND c.valid = 1
AND b.valid = 1
AND c.aktif = 1
AND b.aktif = 1
OPEN cursor_for_inline_select1
FETCH NEXT FROM cursor_for_inline_select1 INTO
/* SwisSQL (Oracle To SQL Server) : Table Information is not found in METADATA for the CURSOR used by the record-index */
WHILE (@@FETCH_STATUS <> -1)
BEGIN
IF @v_unvan = 1
BEGIN
IF /* SwisSQL (Oracle To SQL Server) : Manual Conversion Required */ c.id_mufettis = @p_ID_YONETICI
BEGIN
SELECT @v_result = 1
END
ELSE
BEGIN
SELECT @v_result = 0
END
END
ELSE
IF @v_unvan = 2
BEGIN
-- satis sefi
IF /* SwisSQL (Oracle To SQL Server) : Manual Conversion Required */ c.id_sef = @p_ID_YONETICI
BEGIN
SELECT @v_result = 1
END
ELSE
BEGIN
SELECT @v_result = 0
END
END
ELSE
BEGIN
SELECT @v_yonetici = /* SwisSQL (Oracle To SQL Server) : Manual Conversion Required */ c.id_sef
DECLARE @count INT
SELECT @count = 1
WHILE (0 = 0)
BEGIN --(
SELECT
@v_tmp_unvan = uy.id_unvan,
@v_tmp_yonetici = uy.id_yonetici
FROM lu_yonetici y,
lu_yonetici uy
WHERE y.id_ust_yonetici = uy.id_yonetici
AND y.id_yonetici = @v_yonetici
SELECT @adv_error = @@ERROR
IF @adv_error != 0
BEGIN
GOTO Exception1
END
IF @v_tmp_unvan = @v_unvan
BEGIN
IF @v_tmp_yonetici = @p_ID_YONETICI
BEGIN
SELECT @v_result = 1
END
ELSE
BEGIN
SELECT @v_result = 0
END
END
ELSE
BEGIN
SELECT @v_yonetici = @v_tmp_yonetici
END
IF @v_result = 1 or @v_tmp_unvan >= @v_unvan
BREAK
SELECT @count=@count +1
END --)
END
IF @v_result = 1
BREAK
FETCH NEXT FROM cursor_for_inline_select1 INTO
/* SwisSQL (Oracle To SQL Server) : Table Information is not found in METADATA for the CURSOR used by the record-index */
END
CLOSE cursor_for_inline_select1
DEALLOCATE cursor_for_inline_select1
DEALLOCATE cursor_for_inline_select1
return @v_result
GOTO ExitLabel1
Exception1:
BEGIN
DEALLOCATE cursor_for_inline_select1
return 0
/* SwisSQL (Oracle To SQL Server) : Manual Intervention to verify Exception is required */
END
ExitLabel1:
return @v_result
END
GO
########################################################################################################
edit: для более подробной информации смотрите this question