SQL: Procedure sp_executesql: expects parameter ‘@statement’ of type ‘ntext/nchar/nvarchar’

I ran into this lovely error today and it was because I’m still learning SQL. I guess sometimes you need to define ‘sp_executesql’ and this is what I ran into…

 

I had to declare the below information for the lovely error: 




"Procedure sp_executesql: expects parameter '@statement' of type 'ntext/nchar/nvarchar'" 
to disappear.

 




DECLARE @SQL NVARCHAR(100)
SET @SQL = 'SELECT TOP 1 * FROM sys.tables'
EXECUTE sp_executesql @SQL