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