例如,创建表的时候用的是create table aa.table,那么Schema就是aa(如果不指定,就是默认的dbo)。我的问题是,有没有类似于user_name(),db_name()的函数,直接取得数据库对象的Schema。注:我不想自己动手写函数,类似
select
b.name as Owner
from
sysobjects a,
sysusers b
where
a.uid = b.uid and
a.name = 'ObjectName'另外:如果实在没有这样的系统函数,有没有更简单的方法得到Schema的值?
谢谢。
select
b.name as Owner
from
sysobjects a,
sysusers b
where
a.uid = b.uid and
a.name = 'ObjectName'另外:如果实在没有这样的系统函数,有没有更简单的方法得到Schema的值?
谢谢。
USE pubs
SELECT PARSENAME('pubs..authors', 1) AS 'Object Name'
SELECT PARSENAME('pubs..authors', 2) AS 'Owner Name'
SELECT PARSENAME('pubs..authors', 3) AS 'Database Name'
SELECT PARSENAME('pubs..authors', 4) AS 'Server Name'
[300分] 求2K,2005通用的取得Schema的方法?