Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cruxmagi
Starting Member
38 Posts |
Posted - 2008-04-24 : 05:37:34
|
| CREATE FUNCTION [dbo].[Compare]( @usrVal varchar(100), @dbVal varchar(100))RETURNS BITASBEGINDECLARE @flag BITDECLARE @userStrLen INTDECLARE @dbStrlen INTDECLARE @counter INT--Default assignmentsSET @counter=1Set @userStrLen=len(@usrVal)Set @dbStrlen=len(@dbVal) IF (@userStrLen != @dbStrlen) BEGIN return 0 END ELSE BEGIN WHILE @counter <= @userStrLen BEGIN IF (substring(@usrVal,@counter,1) != substring(@dbVal,@counter,1)) RETURN 0 SET @counter = @counter + 1 END return 1 END RETURN @flag--SELECT dbo.Compare('sqlserver user defined functions','sqlserver is the best backend')END |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-24 : 05:42:31
|
| Whats your question? |
 |
|
|
cruxmagi
Starting Member
38 Posts |
Posted - 2008-04-24 : 06:18:14
|
| my question is the above procedure will return the integer if string value matches,but i want a function which should return the % of the match,for exampleval1 =learn csharpval2=learning sqlserver is not difficulti want to get the % of match between those values,both strings are related to "learn" |
 |
|
|
|
|
|