• lanky_doodle - Thursday, May 3, 2018 5:39 AM

    Hello,

    Is there anyway I can replicate this within an INSERT/OUTPUT statement:

    declare @ID as table(ID uniqueidentifier);

    insert intotbl_Link_Update_History

    outputinserted.ID into @ID

    values(newid(), @LinkID, getdate(), @user-id);

    selectdbo.fnc_FormatDate(luh.Updated_Date, 106) + ' (' + u.Forename + ' ' + u.Surname + ')'

    fromtbl_Link_Update_History luh join

    tbl_Users u on u.[User_ID] = luh.Updated_By_ID

    whereluh.ID =

    (

    selectID

    from@ID

    );

    The needed result is a scalar value: 1 January 1900 (Firstname Lastname)

    Thanks

    Part of the problem is that you are asking for a SCALAR result from a SELECT from a table.  If you ever have more than one row in that table, it's not going to work.   If you were to just change the = character to the word IN, you'd have a functioning query, but we don't know for sure if that's what you actually need.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)