I have a query to debug and it contains something I haven't seen. Here's the analogue query of my problem.
DECLARE @i AS INT
DECLARE @total AS INT
SET @total = 0
SET @i = 0
IF DATENAME(WEEKDAY,GETDATE()) IN (N'Wednesday') BEGIN
SELECT @total = @total + 1
SET @i = @i + 1
END
SELECT @i
My question is in this part: IN (N'Wednesday'). What is that N before the varchar 'Wednesday'. I have no idea if it's a kind of keyword or something like that. This query is okay to be executed; there will be no error. On the other hand, it would be okay too (as far as I know) when I remove this N. What interests me the most is that, when I change it to be n, it yields error.
Aucun commentaire:
Enregistrer un commentaire