查詢某個(gè)數(shù)據(jù)庫中的所有表 :
select * from sysobjects where xtype='u';
查詢某個(gè)表的表結(jié)構(gò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='要查詢的表名');
隨機(jī)選擇記錄:
select newid();
隨機(jī)讀取若干條記錄:[ ------>n表示要取出的數(shù)據(jù)行數(shù)]
sqlserver------>: select top n * from 表名 order by newid();
mysql--------->: select * from 表名 order by rand() limit n;
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點(diǎn)擊舉報(bào)。