Fix “NEXT VALUE FOR function does not support the PARTITION BY clause.” (Error Msg 11716) in SQL Server

If you’re getting an error that reads “NEXT VALUE FOR function does not support the PARTITION BY clause” in SQL Server, it’s probably because you’re trying to use the PARTITION BY sub clause in an OVER clause when using NEXT VALUE FOR to increment a sequence object.

In other words, the NEXT VALUE FOR function does not support the PARTITION BY sub clause of the OVER clause.

To fix this issue, either remove the PARTITION BY clause or change the statement to use another method for partitioning the results.

Continue reading

Get All Parameters from a SQL Server Database (T-SQL)

In SQL Server we can query the sys.parameters system catalog view to return all parameters that belong to user-defined objects.

For system objects, we can query the sys.system_parameters view. We can alternatively query the sys.all_parameters system catalog view to return all parameters that belong to either user-defined or system objects.

Continue reading