t sql dynamic top n query code example Example: t sql dynamic top n query SELECT TOP (@top) * FROM tablename;