sql记录

sqlserver2008

(1)查询所有的数据库名字:

use master;
select *  from sysdatabases;

(2)查询指定库中用户建的的所有表:
select t.name from [指定库]..sysobjects  t where xtype=‘u‘ and status>=0

(3)查询指定表的描述:
select a.name as table_name,b.name as column_name,cast(isnull(c.[value],‘‘) as varchar(23)) as comments
from sys.tables a  inner join sys.columns b on b.object_id=a.object_id left join sys.extended_properties c on c.major_id=b.object_id and c.minor_id=b.column_id where a.name= ‘指定表‘;

-------------------------------------------------------------------------------------------------

mysql

(1)把某个表中查询的记录插入另一张表:

insert into 某库名.表名(guId,gxId,loginName,userName,phone,telephone,email,Duties,Type,createDate,serino,idnum,sex,birth,grade,status,oldid)
select UUID(),oid,name,name,phone,phone,‘‘,Position,‘3‘,‘‘,‘‘,Idcard,‘‘,‘‘,‘‘,‘‘,‘‘ from 某库名.另一表名;

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。