Stored procedure incomplete concatenation of string

  •  

    I have problem where the concatenetion of a string cuts at a position in the middle of building it. Se code below where the fat text is the text that i built and the other text is omitted.

    On my computer this works perfectly but when I deploy it on other computers the string i cut at position 526 (char number where it CUTS)

    As it is now it works on 2 comuters and not working on 2 comuters + the server where it will run.

    I need inputs on this problem  

    CREATE PROCEDURE CSMS.sp_Get_STLList

    @status int = -1,

    AS

    DECLARE @sSQL as nvarchar(4000)

     BEGIN

     SET @sSQL =

      'SELECT stl.location

      , stl.trunid

      , stl.abc

      , lct.height

      , sts.description as status

      , ISNULL(CSMS.fn_GetTypeDescription(''STL'', stl.locked, ''LOCKED'', type.language), stl.locked) AS locked

      FROM CSMS.Sts as sts,

      CSMS.type as type

      , CSMS.stl as stl INNER JOIN

      CSMS.lct as lct ON lct.locationtype = stl.locationtype'

     SET @sSQL = @sSQL + ' WHERE sts.status = stl.status and sts.tablename = ''STL'' AND type.value = stl.locked  AND type.type = ''LOCKED'' and type.tbl =  ''STL'' '

    END

    EXEC sp_executeSQL @sSQL

    RETURN 0

    GO

     

    Best regards

    Peter

  • I think your procedure is incomplete, when you are entering all the values inside the procedyure in where condition, then why do you want to create a dynamic query and execute that.

    You can write a strightforward query inside the procedure.

     

  • Is this a query analyzer problem only? In query analyzer, check tools, options, results tab. What does it say under "maximum characters per column"?

     

  • Try doing a PRINT @sSQL and then try to execute the output.

  • Hi

    Big thanks, problem is solved!

    The setting on some computers including the server was 256 char, my was 8000 char so I changed the others to that as well

    Hope it's not a problem to allow that many ?

     

    //Peter

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply