分享

数据库

 xiagirl333 2009-08-20
查询某个数据库中的所有表 :
select * from sysobjects where xtype='u';
 
 
查询某个表的表结构:
select col.[name] as '字段名',
         col.[length] as '长度',
         type.[name] as '类型',
         pro.value as '描述'
from syscolumns as col
left join Systypes as type on col.xtype=type.xtype
left join SysProperties as pro on col.id=pro.id and col.colid=pro.smallid
where col.id=(select id from Sysobjects where name='要查询的表名');
 
 
随机选择记录:
select newid();
 
随机读取若干条记录:[ ------>n表示要取出的数据行数]
sqlserver------>:     select top n * from 表名 order by newid();       
mysql--------->:     select * from 表名 order by rand() limit n;

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约