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. Just curious. 回答1: You can call CREATE Function near the beginning of your script and DROP Function near the end. 回答2: You can create temp stored procedures like: create procedure #mytemp as begin select getdate() into #mytemptable; end in an SQL