• nancy.lytle (8/29/2008)


    Hugo, about your code:

    SET @ComplaintList = ''

    SELECT @ComplaintList = @ComplaintList+ UserComplaint+ char(13)

    FROM ComplaintsTable

    WHERE UserID=@UserID

    ..

    Return @ComplaintList

    I thought that might be something I could use for various things, but I cannot get the code to work, even with the .. commented out. Is there something missing from the code (I of course substituted my name for yours)

    Nancy

    Hi Nancy,

    This code was not posted by me, but by Shnizzle.

    Code such as this is not documented and not guaranteed to do what you might expect (and frankly, I don't even know exactly WHAT you expect, as there's more than one result that can be argued to be correct). However, many people seem to report consistent results and choose to rely on this undocumented construction.

    Maybe you can post your actual code, along with CREATE TABLE statements for your tables, INSERT statemtents for your test data, and the required results. There might be a better way to achieve what you need.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/