cancel
Showing results for 
Search instead for 
Did you mean: 

Check Store Procedure Name Exists or Not

Former Member
0 Kudos

Hi All

Please kindly check this code for Store Procedure Exists or not .

''' <summary>

    ''' To Check Store Procedure Exists or Not

    ''' </summary>

    ''' <param name="SPName">Pass Store Procedure Name</param>

    ''' <returns>return TRUE or FALSE</returns>

    ''' <remarks>To Check Whether Store Procedure Exists or Not</remarks>

    Public Function CheckSPExists(ByVal SPName As String) As Boolean

        otempRecset = oApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

        otempRecset.DoQuery("SELECT CASE COUNT('A') WHEN 1 THEN 'EXISTS' ELSE 'NOT EXISTS' END FROM Sys.objects WHERE Name =" & SPName & "AND  Type = 'P'")

        If otempRecset.RecordCount > 0 Then

            Return True

        Else

            Return False

        End If

    End Function

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I am afraid your query:


SELECT CASE COUNT('A') WHEN 1 THEN 'EXISTS' ELSE 'NOT EXISTS' END FROM Sys.objects WHERE Name =" & SPName & "AND  Type = 'P'

may not be able to add to the DoQuery directly without additional "+" sign and/or " ' " character. You may try to print the result to see what DoQuery can get.

Thanks,

Gordon