I am still trying to make sense of the whole n' when selecting text or varchar values... Is that so necessary? Can someone give me an example?
To summarize what the other folks on this thread have said, the N' is how you mark string literals as NVARCHAR literals. If you're working with NVARCHAR datatypes, such as when they appear in sp_ExecuteSQL or table columns with an NVARCHAR datatype, it's best to use the N' prefix. It's also best NOT to use it on string literals when comparing to a VARCHAR column in a table because using the N' prefix on a literal to be compared to a VARCHAR column requires that the whole column of data must be converted before the comparison can be made. That's obviously a "Non SARGable" comparison of the worst kind.
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs