.SQLPLAN files saved as ANSI, marked as UNICODE

  • If you right click an execution plan and ask it to save the file, it will. You can save it as XML or as SQLPLAN. You can reopen it in SSMS. What you can't do it refer to it as a file in an OPENROWSET command because the file is ANSI even though it says it's UTF-16, UNICODE. Does anyone know a way to make this save the file in a manner consistent with what it says it is?

    The workaround is to open the file in notepad or something and save it back as UNICODE, but what a pain.

    Anyone?

    "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

  • All right, now I'm mad.

    If I run a profiler trace and capture XML execution plans, I can save those to file. They save correctly as UNICODE.

    What the heck is up with that?

    I'm going to try all this out in SQL Server 2008

    "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

  • Have you tried the sys.dm_exec_query_plan function? mine doesn't seem to put that annoying notation at the top as to it being unicode.

    The other options return the showplan in one big nvarchar(max), which I think is why the save as tags on the utf-16.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • No, I haven't gone there yet. Actually, I keep forgetting that dmv exists.

    Yeah, it's working just fine.

    "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

  • FWIW, SQL Server 2008 has the same stupid problem.

    "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

  • I had to go look it up again. I kind of remembered a way - but couldn't place what it was I needed.

    Thanks for the heads up on 2008.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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