How can we help you today? How can we help you today?
Olaf Pietsch DETECON
Hello Brian, I am using only SQL Server 2005 not 2000. I'd like explaining more in detail my steps (all codings are in my first posting): 1. I used the Visual Studio 2005 (VS) to develop the c# CRL function: ... [Microsoft.SqlServer.Server.SqlFunction( DataAccess=DataAccessKind.None ,IsDeterministic=true ,IsPrecise=true ,SystemDataAccess=SystemDataAccessKind.None ,Name="fn2_regexIsMatch" ) ] public static SqlBoolean clrs_f_regexIsMatch([SqlFacet(MaxSize = -1)]SqlString expressionToValidate, [SqlFacet(MaxSize = -1)]SqlString regularExpression) { ... There are the definitions of the parameters ([SqlFacet(MaxSize = -1)]SqlString ...) to use the SQL data type nvarchar(max) in the T-SQL interface (UDF). (In this case I am not able to use the default data type mapping between CLR and SQL Server data types of VS.) 2. I used the auto-deploy function of VS. 3. I scripted the T-SQL UDF (fn2_regexIsMatch) with SSMS to check the auto-deployed UDF. ... /****** Object: UserDefinedFunction [dbo].[fn2_regexIsMatch] Script Date: 10/12/2006 14:00:59 ******/ CREATE FUNCTION [dbo].[fn2_regexIsMatch](@expressionToValidate [nvarchar](max), @regularExpression [nvarchar](max)) RETURNS [bit] WITH EXECUTE AS CALLER AS EXTERNAL NAME [DETECON_safe].[UserDefinedFunctions].[clrs_f_regexIsMatch] GO ... The parameters are all of type nvarchar(max) not nvarchar(0)! (I have tested this function with SQL Server, it is running.) 4. Then I used SQL-Compare to transfer the code of the UDF to another SQL Server 2005 and I got the Error message with SQL-Compare: ... [1001] Line 1: Length or precision specification 0 is invalid. ... CREATE FUNCTION [dbo].[fn2_regexIsMatch] (@expressionToValidate [nvarchar] (0), @regularExpression [nvarchar] (0)) ... What do you think? Thanks, Olaf / comments
Hello Brian, I am using only SQL Server 2005 not 2000. I'd like explaining more in detail my steps (all codings are in my first posting): 1. I used the Visual Studio 2005 (VS) to develop the c# CRL...
0 votes