在SQL Server中创建一个全局静态变量? [英] Create a global static variable in SQL Server?
本文介绍了在SQL Server中创建一个全局静态变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在SQL Server中创建一个全局变量,即使服务器重启,它仍然存在,所以我可以在函数中使用它?
DECLARE @@ DefaultValue位
这个变量应该永远不会被删除,除非我明确地这么做。
解决方案
我猜这对我最好:
CREATE FUNCTION [dbo]。[fn_GetDefaultPercent]()
RETURNS decimal(5,4)
AS
BEGIN
RETURN 1.0000
END
Is there a way to create a global variable in SQL Server, in such a way that it persists even if the server is restarted, so I can use it in functions?
Example from what I need:
DECLARE @@DefaultValue bit
This variable should never be deleted unless I explicityl do so.
解决方案
I guess this will work the best for me:
CREATE FUNCTION [dbo].[fn_GetDefaultPercent]()
RETURNS decimal(5,4)
AS
BEGIN
RETURN 1.0000
END
这篇关于在SQL Server中创建一个全局静态变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文