Non-printable characters in SQL Scripts out of SSMS?

  • We're seeing wierd things in SSMS using the "Script as Create" function. For example using this capability on a Stored Procedure resulted in:

    -- Calculate net revenue

    ACK SET @NetResult=@FiscalYear-@PriorFiscalYear

    Where "ACK" is actually the ASCII x06 character.

    Any idea where these are coming from?:w00t:

     

  • I would guess they were in the original script that created it. You could interogate syscomments and see if it is in the system table (ok view) and I suspect it is. If it is then I would wager heavily on it being in the original script.

    CEWII

  • Hmmm... No. I haven't seen that one. Is it possible that there's a difference in the server or database collation? That might lead to something like this.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • The procedure was originally developed by hand in SSMS (New Stored Procedure). I don't think the developer typed in a hex 06 while he was typing the code...

    The developer "corrected" the function so now the character is not there. We're going to restore the db and look at information_schema.routines to see if it shows up in the text. That will tell us whether its in the actual definition of the procedure or if its an artifact of the scripting process...

    More to follow.

     

  • Ah, you know what it might be? One guy in my office (and he's the only one for some reason), has a lot problems with files getting saved with the wrong encoding. Happens to him all the time (again, he's the only one), but when he saves a file with some messed up code page and then runs it against the server, we get odd, really odd, characters in the code running on the machine. Usually it results in compile time errors when he tries to run the code, but ocassionally stuff slips through.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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