Home All Groups Group Topic Archive Search About
Author
12 Aug 2006 5:36 PM
windy
Hi all,
   I would like to know the ways to make a global constant variable (number,
or nvarchar) which all my SP can use it directly.

Thanks a lot.
Windy

Author
12 Aug 2006 6:01 PM
Tibor Karaszi
No such built-in direct functionality. Insert the value(s) into a table, which all who need can read
from.

Show quote
"windy" <wi***@gmail.com> wrote in message news:O07J$SjvGHA.4436@TK2MSFTNGP05.phx.gbl...
> Hi all,
>   I would like to know the ways to make a global constant variable (number, or nvarchar) which all
> my SP can use it directly.
>
> Thanks a lot.
> Windy
>
Author
12 Aug 2006 6:03 PM
David Portas
windy wrote:
> Hi all,
>    I would like to know the ways to make a global constant variable (number,
> or nvarchar) which all my SP can use it directly.
>
> Thanks a lot.
> Windy

CREATE TABLE Parameters (...)

....

SELECT @param1 = param1
FROM Parameters

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Author
12 Aug 2006 10:53 PM
Erland Sommarskog
windy (wi***@gmail.com) writes:
>    I would like to know the ways to make a global constant variable
> (number, or nvarchar) which all my SP can use it directly.

CREATE VIEW MyConstants AS
   SELECT MyFirstConstant AS 10,
          MySecondConstant AS 'Hey Nineteen',
          MyThirdConstant AS convert(datetime, '20021212')


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button