2

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 
0

1 Answer 1

2

Write it as a SQL Server CLR stored procedure.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.