Take the 2-minute tour ×

This question already has an answer here:

I want a function similar to @@servername to be created. So, the new @@mycustomname will return something I set up and then I can use @@mycustomname in my deployed T-SQL Scripts.

Is there a way to do it?

share|improve this question
I am not certain but I believe the designation of @@(something) is a system reserved variable. I don't believe you can create these things. However if you just want a return for metadata or other types that is definitely possible with Scalar functions or custom types. It all depends on what you want to return. –  djangojazz Feb 22 '13 at 19:55
add comment

marked as duplicate by George Stocker Mar 4 '13 at 15:03


1 Answer

No you can't. These are reserved keywords.

What you want to be somewhat equivalent to global variables, which unfortunately does not exists.

The best you can do is declare a function.

share|improve this answer
add comment
