Understanding Trace items

  • The following is an item in my trace. I understand the basics of what it is doing but I don't understand the syntax.

    declare @P1 int

    set @P1=5

    exec sp_prepexec @P1 output, N'@P1 varchar(255)', N'DELETE FROM LOGINS WHERE MACHINE_ID = @P1', '796A676D7982787B878878697B7E7A71'

    select @P1

    What are the capital N's For?

    sp_prepexec is not in BOL and only vaguely discussed in development articles.

    Thanks,


    Kindest Regards,

    Sean Wyatt
    seanwyatt.com

  • N is used to cast the string as NVARCHAR instead of VARCHAR.

  • Thanks John that helps.

    So sp_prepexec takes a command string as input, and generates an execution plan so that it can be quickly executed later??

     

     


    Kindest Regards,

    Sean Wyatt
    seanwyatt.com

Viewing 3 posts - 1 through 2 (of 2 total)

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