SQL Server error 4121: Cannot find column or function
A call like schema.function() couldn't be resolved to a column method or user-defined function: wrong schema, a typo, or a function that isn't deployed.
- Error number
4121- Severity
- 16
- Category
- Names and objects
What it means
SQL Server raises 4121 when an expression of the form name.something(...) can't be bound to a column method or a user-defined function or aggregate. Scalar user-defined functions must be called with at least a two-part name such as dbo.MyFunction(), and 4121 usually means that two-part name points at the wrong schema or at a function that doesn't exist there.
Common causes
- The function exists in another schema or database than the one named.
- A typo in the function name, or the function wasn't deployed.
How to fix it
-
Find the function and its schema.
SELECT SCHEMA_NAME(schema_id) AS schema_name, name, type_desc FROM sys.objects WHERE type IN ('FN', 'IF', 'TF', 'FS', 'FT') AND name = N'FormatName'; -
Call it with the correct schema-qualified name.
SELECT dbo.FormatName(FirstName, LastName) FROM dbo.People;
Related errors
2812Could not find stored procedure208Invalid object name207Invalid column name42883PostgreSQL: function does not exist
More names and objects errors
4104Multi-part identifier not bound209Ambiguous column name2714There is already an object named3701Cannot drop, object not found3702Cannot drop database, currently in use5030Database couldn't be exclusively locked8144Too many arguments specified8145Is not a parameter for procedure
The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.
Work on SQL Server in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.