Hi all,
I want to know how to assin a return value to a variable when calling a regex function.
it always returns a bit type of value(its ok). i want that bit type of value tobe cheked whether it is '0' or '1'
this is my C# code in case if u need
namespace SearchBooksLibrary
{
public partial class SqlRegularExpressions
{
public static int Like(string text, string pattern)
{
Match match = Regex.Match(text, pattern);
if (match.Value != String.Empty)
return 1;
else
return 0;
}
}
}
this is my assembly.
CREATE ASSEMBLY SqlRegularExpressions1
from 'C:\Users\BJ\Documents\Visual Studio 2008\Projects\Project1\SearchBooksLibrary\SearchBooksLibrary\bin\Debug\SearchBooksLibrary.dll'
WITH PERMISSION_SET = SAFE
this is my function
CREATE function RegExpLike(@Text nvarchar(max), @Pattern nvarchar(255)) RETURNS bit
AS EXTERNAL NAME SqlRegularExpressions1.[SearchBooksLibrary.SqlRegularExpressions].[Like]
this is what i want to do which doesnt work
declare @tt nvarchar(max)
set @tt='i love sql but not the other'
declare @ttT nvarchar(max)
set @ttT='(\w*sql\w*)*(server\w*)'
declare @flag bit
@flag=select dbo.RegExpLike(@tt,@ttT )--this line does not work it says Incorrect syntax near '@flag'.
plz help me