Reputation: 13243
This is the code in VB Script, how would it be done if i was to build a function called dbo.FileNameEncode(str) in SQL Server ?
Function FileNameEncode(ByVal strFileName)
Dim oReg
strFileName = LTrim(Rtrim(strFileName))
Set oReg = New RegExp
oReg.IgnoreCase = True
oReg.Global = True
oReg.Pattern = "[^a-z\d\s.]+"
FileNameEncode = Replace(oReg.Replace(strFileName, ""), " ", "_")
Set oReg = Nothing
End Function
Upvotes: 2
Views: 1344