[英]Fill default value based on logged in user
I am defining a new table where a column suppose to store name of the logged in user. 我正在定义一个新表,其中的一列应该用来存储已登录用户的名称。 How to grab logged in user name as default value for a column? 如何获取登录用户名作为列的默认值? Is it possible out of the box ? 开箱即用吗?
您可以使用SYSTEM_USER
变量来填充。
I would recommend using ORIGINAL_LOGIN in case there is some impersonation going on. 我建议您使用ORIGINAL_LOGIN,以防假冒。 It will always get the user name that initiated the connection. 它将始终获得启动连接的用户名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.