I know that I can define default values for CLR procedures when creating the procedure in the database, like this:
CREATE PROCEDURE [dbo].[ShredXml] (
@InputXml [xml],
@AttributeElementHandling [tinyint] = 0,
@ConversionHandling [tinyint] = 0,
@RootElementName [nvarchar](255) = null
)
AS EXTERNAL NAME [ClrXmlShredder].[ClrXmlShredder].[ShredXml]
What I can't figure out is whether there's any way to convince Visual Studio to do this automatically when using its "Deploy Project" option...
Is there an attribute one can set on an argument to tell visual studio what you want the default value for that argument to be, when it creates the proc in the database?
Update: I've tried setting the nullability "SqlFacet", that seemed to have no effect (which makes sense I guess - afaik stored proc params are always nullable?)
[Microsoft.SqlServer.Server.SqlProcedure]
public static void ShredXml(SqlXml InputXml,
[SqlFacet(IsNullable = true)]SqlByte AttributeElementHandling,
[SqlFacet(IsNullable = true)]SqlByte ConversionHandling,
[SqlFacet(MaxSize = 255, IsNullable = true)]string RootElementName
)
{
}