Support default parameter values for NVARCHAR(MAX), VARBINARY(MAX), and XML types in SQLCLR objects - by Solomon Rutzky

Status : 


Sign in
to vote
ID 1565637 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 7/19/2015 2:19:00 PM
Access Restriction Public


While it is possible to specify default parameter values for the NVARCHAR(MAX), VARBINARY(MAX), and XML datatypes when creating T-SQL stored procedures and functions, it is not allowed when creating the T-SQL wrapper objects for SQLCLR methods. Attempting to add a default for a parameter of any of these types results in the following error:

Msg 1096, Level 16, State 2, Procedure EncodingTest, Line 2
Default parameter values for CLR types, nvarchar(max), varbinary(max), and xml are not supported.

However, the following does work:

CREATE PROCEDURE dbo.MaxParamDefault
	@Bob NVARCHAR(MAX) = 'yo'
SELECT @Bob AS [ThisIsTheBob];
Sign in to post a comment.