if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_Insert_T_FR_RECORD]') and xtype = N'P')
DROP PROCEDURE  [dbo].[sp_Insert_T_FR_RECORD]
GO

--SET ANSI_NULLS ON
--GO
--SET QUOTED_IDENTIFIER ON
--GO
--ALTER procedure [dbo].[sp_Insert_T_FR_RECORD] (
--@Snils as varchar(255)
--, @Deleted as bit
--, @DateBegin as datetime
--, @DateEnd as datetime
--, @NSU as bit
--, @DateNsuBegin as datetime
--, @DateNsuEnd as datetime
--, @Nsus as bit
--, @Version as int
--, @UpdateDate as datetime
--)
--as

--if not exists (select 0 from [AKUZ].T_SNILS where Snils = @Snils)
--insert [AKUZ].T_SNILS (Snils) values (@Snils)

--insert [AKUZ].T_FR_RECORD (FrRecordID, Snils, Deleted, DateBegin, DateEnd, NSU, DateNsuBegin, DateNsuEnd, Nsus, [Version], UpdateDate)
--values (NEWID(), @Snils, @Deleted, @DateBegin, @DateEnd, @NSU, @DateNsuBegin, @DateNsuEnd, @Nsus, @Version, @UpdateDate)