• VastSQL - Sunday, March 4, 2018 2:57 AM

    Eirikur Eiriksson - Sunday, March 4, 2018 2:21 AM

    VastSQL - Sunday, March 4, 2018 2:10 AM

    Hi Experts,

    I have created a filetable with full access and created a trigger on Filetable to insert the filename and streamid to another normal table.Everything was working as expect but when i moved the same setup from one server to another the file insertion to folder failed with below errors.

    --when tried using TQL
    Msg 33409, Level 16, State 1, Line 11
    The operation caused a FileTable check constraint error. A file entry cannot have a NULL value for the data stream associated with the row. Insert file data or use 0x to insert a zero length file.

    --when copied the file to location
    The system cannot find message text for message number 0xfilename.sql in the message file for (null).

    if i remove the trigger the copying works fine.

    The difference between two servers are one is using disks and the other one is having mount points.

    Is the one failing the one with the mount pints? 
    😎
    It might also be helpful if you post the trigger code.

    Thanks Eirikur for the quick reply.

    Yes its failing in server with Mount Points. Please find the trigger code

    Create TRIGGER [dbo].[Insert_Datain] ON [dbo].[BizTalkFT]
    FOR INSERT AS
    DECLARE @Stream_ID uniqueidentifier
    DECLARE @Filename nVARCHAR(100)
    DECLARE @CreateDate DAtetime

    SELECT @Stream_ID =([Stream_id]) FROM INSERTED
    SELECT @Filename=([name]) FROM INSERTED
    SELECT @CreateDate=(Creation_Time) FROM INSERTED

    INSERT INTO
    [AllDocs]
    ([Filename],CreateDate)
    VALUES
    (
    @Filename,@CreateDate
    )
    GO

    My suggestion would be to change the trigger, regardless whether that is the cause of the problem or not, as this code can only handle single row inserts.
    😎


    CREATE TRIGGER [dbo].[Insert_Datain] ON [dbo].[BizTalkFT]
    FOR INSERT AS

    INSERT INTO [AllDocs] ([Stream_id],[Filename],CreateDate)
    SELECT
     I.[Stream_id]
    ,I.[Filename]
    ,I.CreateDate
    FROM INSERTED I
    WHERE I.[Stream_id] IS NOT NULL;
    GO