Categories

Access: Remove Stored Procedure

We have seen how to create and use a stored procedure – but as part of our usage patterns we need to be able to delete stored procedures as well.

001
002
003
004
005
006
007
008
009
010
011
012
013
function Remove-AccessStoredProcedure {
# .ExternalHelp Maml-AccessFunctions.XML
[CmdletBinding()]
param (
    [System.Data.OleDb.OleDbConnection]$connection,
    [string]$name
)
    $sql = "DROP PROCEDURE $name"
    Write-Debug $sql
   
    $cmd = New-Object System.Data.OleDb.OleDbCommand($sql, $connection)
    $cmd.ExecuteNonQuery()   
}

 

Simple function to pass the name of the procedure and call a DROP ROCEDURE statement.

 

One Response to Access: Remove Stored Procedure

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>