RE: Table owner

RE: Table owner

 

  

Whenever possible, Use Information_Schema Views.

Its SQL 92 standard and querying the system tables
is not recommended.

---- FROM BOL

These views provide an internal, system table-independent view of the
SQL Server meta data. Information schema views allow applications to
work properly even though significant changes have been made to the
system tables. The information schema views included in SQL Server
conform to the SQL-92 Standard definition for the INFORMATION_SCHEMA

----

Select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
From Information_Schema.Tables
Where TABLE_TYPE = 'BASE TABLE'
And TABLE_NAME = <tablename>

John
www.ideo.com

-----Original Message-----
From: Shibu MB [mailto:[Email Address Removed]
Sent: February 19, 2003 1:36 AM
To: LazyDBA.com Discussion
Subject: RE: Table owner





Thanks a lot saritha .......

Shibu


-----Original Message-----
From: Sarita Janjani [mailto:[Email Address Removed] Wednesday, February 19, 2003 2:49 PM
To: Shibu MB; Sarita Janjani; LazyDBA.com Discussion
Subject: RE: Table owner


select A.name,B.NAME,db_name() from sysobjects a, sysusers b
where a.uid = b.uid
and a.name ='AUTHORS'

what exactly is your requirement...

-----Original Message-----
From: Shibu MB [mailto:[Email Address Removed] Wednesday, February 19, 2003 2:57 PM
To: Sarita Janjani; LazyDBA.com Discussion
Subject: RE: Table owner




saritha .. the below query will give the table name and owner but how
to get the dbname ?????


select A.name,B.NAME from sysobjects a, sysusers b
where a.uid = b.uid
and a.name ='AUTHORS'

Thanks
shibu






-----Original Message-----
From: Sarita Janjani [mailto:[Email Address Removed] Wednesday, February 19, 2003 2:24 PM
To: Shibu MB; LazyDBA.com Discussion
Subject: RE: Table owner


use sysusers to get uid and match uid from sysobjects to relate both the
tables Thanks, Sarita


-----Original Message-----
From: Shibu MB [mailto:[Email Address Removed] Wednesday, February 19, 2003 2:23 PM
To: LazyDBA.com Discussion
Subject: Table owner


Hi friends ....

How can i find the table owner and database name from the data
dictionary .For example from the query given below how will i get
PGSD_TEST1 and DBO from the system table ???? in sysobjects it's not
there ....

SELECT Trans_Id ,Trans_Type , PS_Inv_Id,
Total_Deposit_Amt ,Location_Id ,load_date
FROM PGSD_TEST1.DBO.PG_TRANS_DET


Thanks
Shibu



DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Private Limited (MindTree) will not be
responsible for any viruses or defects or any forwarded attachments
emanating either from within MindTree or outside. If you have received
this message by mistake please notify the sender by return e-mail and
delete this message from your system. Any unauthorized use or
dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change and
MindTree shall not be liable for any improper, untimely or incomplete
transmission.


DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Private Limited (MindTree) will not be
responsible for any viruses or defects or any forwarded attachments
emanating either from within MindTree or outside. If you have received
this message by mistake please notify the sender by return e-mail and
delete this message from your system. Any unauthorized use or
dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change and
MindTree shall not be liable for any improper, untimely or incomplete
transmission.


DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Private Limited (MindTree) will not be
responsible for any viruses or defects or any forwarded attachments
emanating either from within MindTree or outside. If you have received
this message by mistake please notify the sender by return e-mail and
delete this message from your system. Any unauthorized use or
dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change and
MindTree shall not be liable for any improper, untimely or incomplete
transmission.

---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To
unsubscribe, e-mail: mssqldba-[Email Address Removed] For additional
commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page