sqlsql-serversql-server-2005t-sqlscripting

Can I create a One-Time-Use Function in a Script or Stored Procedure?


In SQL Server 2005, is there a concept of a one-time-use, or local function declared inside of a SQL script or Stored Procedure? I'd like to abstract away some complexity in a script I'm writing, but it would require being able to declare a function.


Solution

  • You can call CREATE Function near the beginning of your script and DROP Function near the end.