데이터베이스 시트 정보 조회

3614 단어 데이터 구조F#
[color=darkblue]
       

SELECT code,name, tree_link,precode,cast(srt as varchar) orders, 1 AS [Level] FROM ( select t.ID code, T.NAME, T.MENUTYPE, T.URL tree_link, T.PARENTID precode, right(str(t.sort+100000),5)   srt  from sys_privilege t where t.id in (select gp.id id from SYS_GROUP_PRIVILEGE GP, SYS_USER_GROUP UG where ('100' is null or ug.userid = '100') and gp.groupid =ug.groupid ) and t.menutype = '0' ) aa  WHERE code = '98'  UNION ALL    SELECT aa.code, aa.name,aa.tree_link,aa.precode,cast(cast(TreeCTE.orders as varchar)+' '+cast(aa.srt as varchar) as varchar) orders, [Level] + 1  FROM TreeCTE  INNER JOIN ( select t.ID code, T.NAME, T.MENUTYPE, T.URL tree_link, T.PARENTID precode, right(str(t.sort+100000),5)   srt  from sys_privilege t where t.id in (select gp.id id from SYS_GROUP_PRIVILEGE GP, SYS_USER_GROUP UG where ('100' is null or ug.userid = '100') and gp.groupid =ug.groupid ) and t.menutype = '0' ) aa  ON TreeCTE.code = aa.precode   )  select code,name,'/isms'+tree_link tree_link,precode from TreeCTE order by orders 
(1)
SELECT 
  =case when a.colorder=1 then d.name else '' end,
   =case when a.colorder=1 then isnull(f.value,'') else '' end,
    =a.colorder,
   =a.name,
  =case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then '√'else '' end,
  =case when exists(SELECT 1 FROM sysobjects where xtype='PK' and parent_obj=a.id and name in (
SELECT name FROM sysindexes WHERE indid in(
SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid
))) then '√' else '' end,
  =b.name,
     =a.length,
  =COLUMNPROPERTY(a.id,a.name,'PRECISION'),
    =isnull(COLUMNPROPERTY(a.id,a.name,'Scale'),0),
   =case when a.isnullable=1 then '√'else '' end,
   =isnull(e.text,''),
    =isnull(g.[value],'')
FROM syscolumns a
left join systypes b on a.xusertype=b.xusertype
inner join sysobjects d on a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
left join syscomments e on a.cdefault=e.id
left join sysproperties g on a.id=g.id and a.colid=g.smallid  
left join sysproperties f on d.id=f.id and f.smallid=0
--where d.name='     '    --        ,     
order by a.id,a.colorder

(2)

SQL2000       
--1:              

select Name from sysobjects where xtype='u' and status>=0

--2:           

select name from syscolumns where id=object_id('  ')

--3:            、    、  

select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%  %'

--4:              

select name as        from sysobjects where xtype='P'

--5:            

select * from master..sysdatabases D where sid not in(select sid from master..syslogins where name='sa')

  

select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01

--6:              

select column_name,data_type from information_schema.columns
where table_name = '  ' 

--7:        
select name, 
(select value from sysproperties where id = syscolumns.id and smallid=syscolumns.colid) as   
from syscolumns where id=object_id('  ')
[/color]

좋은 웹페이지 즐겨찾기