Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (20.3k points)

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 Answer

0 votes
by (40.4k points)

You can try creating the temp stored procedures this way:

create procedure #mytemp as

begin

   select getdate() into #mytemptable;

end

in an SQL script, but not functions. You could have the proc store it results in a temp table though, then use that information later in the script.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.2k users

Browse Categories

...