Files
Fuchs_Intranet/Fuchs_Database/dbo/Stored Procedures/fds__setMFRInvoiceFile.sql
T
Stefan 10ecdfa2e4 Add Fuchs_Database SSDT project (schema source of truth)
Adds the SQL Server Data Tools project for the fuchs_fds database — tables,
table types, functions and stored procedures that the backend calls (e.g.
fds__getInvoice, fds__merge_bankingtransactions, fds__tt__bankingtransactions,
fds__admin_getReportCatalog, fis_* auth). Build/model caches (bin, obj,
*.dbmdl, *.jfm, *.user) are git-ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:50:54 +02:00

30 lines
933 B
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[fds__setMFRInvoiceFile]
@Id varchar(15),
@filename varchar(100),
@file varbinary(max)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @now datetime = GETUTCDATE();
DECLARE @Idnum bigint = TRY_CAST(@id as bigint);
INSERT INTO [dbo].[fds__admin_activity] ([activity] ,[authuser] ,[info])
VALUES ('fds__setMFRInvoiceFile' ,'' , (SELECT * FROM (VALUES(@Id, '')) as z ([id],[authuser]) FOR JSON PATH, INCLUDE_NULL_VALUES, WITHOUT_ARRAY_WRAPPER));
IF @idnum is not null and NOT EXISTS (SELECT 0 FROM [dbo].[fds__mfr_invoicefiles] WHERE [id] = @id)
BEGIN
INSERT INTO [dbo].[fds__mfr_invoicefiles]
([Id]
,[filename]
,[file])
VALUES
(@Id
,@filename
,@file)
END;
END