AzurePoolCrossDbGenerator/DbAccess.cs
/// <summary>
/// Returns TRUE if the SP exists in the target DB
/// </summary>
Returns TRUE if the SP exists in the target DB
Returns TRUE if the SP exists in the target DB
public static bool CheckProcedureExists(string connectionString, string procedureName)
        {
            string queryString = @"select SPECIFIC_NAME from INFORMATION_SCHEMA.ROUTINES where SPECIFIC_NAME = @procedureName";
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                command.Parameters.AddWithValue("@procedureName", procedureName);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                try
                {
                    if (reader.HasRows) return true;
                }
                finally
                {
                    reader.Close();
                }
            }
            return false;
        }
public static bool CheckProcedureExists ( string connectionString , string procedureName ) { string queryString = @"select SPECIFIC_NAME from INFORMATION_SCHEMA.ROUTINES where SPECIFIC_NAME = @procedureName" ; using ( SqlConnection connection = new SqlConnection ( connectionString ) ) { SqlCommand command = new SqlCommand ( queryString , connection ) ; command . Parameters . AddWithValue ( " " , procedureName ) ; connection . Open ( ) ; SqlDataReader reader = command . ExecuteReader ( ) ; try { if ( reader . HasRows ) return true ; } finally { reader . Close ( ) ; } } return false ; }
Returns TRUE if the SP exists in the target DB
Returns TRUE if the SP exists in the target DB
// query INFORMATION_SCHEMA.PARAMETERS for a list of params per procedure // get the list of params from the DB
connectionString
string
procedureName
string