--SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 end),null),null) as NotNullCountfrom syscolumns aINNER JOIN( select [id], [name] from [sysobjects] where [type] = 'u' ) AS b ON a.id = b.[id] GROUP b…
SQL查询一个表中类别字段中Max()最大值对应的记录 SELECT A.id, A.name, A.version FROM DOC A, (SELECT id, MAX(version) AS version FROM DOC GROUP BY id) AS B WHERE A.id = B.id AND A.version = B.version…
摘要:结构上Hive On Spark和SparkSQL都是一个翻译层,把一个SQL翻译成分布式可执行的Spark程序. 本文分享自华为云社区<Hive on Spark和Spark sql on Hive有啥区别?>,作者:dayu_dls . 结构上Hive On Spark和SparkSQL都是一个翻译层,把一个SQL翻译成分布式可执行的Spark程序.Hive和SparkSQL都不负责计算.Hive的默认执行引擎是mr,还可以运行在Spark和Tez.Spark可以连接多种数据源,然后…
在做spark开发过程中,时不时的就有可能遇到租户的hive库目录下的文件个数超出了最大限制问题. 一般情况下通过hive的参数设置: val conf = new SparkConf().setAppName("MySparkJob") //.setMaster("local[1]").setMaster("spark://172.21.7.10:7077").setJars(List("xxx.jar")).set(&qu…
Exception: Caused by: org.datanucleus.exceptions.NucleusException: Attempt to invoke the "BoneCP" plugin to create a ConnectionPool gave an error : The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH…
问题描述:只是单纯的执行了"select count(*) from 某表":数据表中只有一两条数据,能查询其他表,唯独这个表不能进行任何操作: 经百度搜索实验,发现应该是某个进程阻塞了,使用了一下代码进行的查询(这个比较详细): declare @spid int,@bl int ,blocked ) a ) b where a.blocked=spid) union )) + ' 进程号, 其执行的SQL 语法如下' else )))) +' 阻塞, 其当前进程执行的SQL 语法如…
//////////////////查询指定表外键约束select a.name as 约束名, object_name(b.parent_object_id) as 外键表, d.name as 外键列, object_name(b.referenced_object_id) as 主健表, c.name as 主键列 from sys.foreign_keys A inner join sys.foreign_key_columns B on A.object_id=b.constraint…
-- 获得存储过程创建语句 select o.xtype,o.name,cm.text from syscomments cm inner join sysobjects o on o.id=cm.id where xtype ='p' order by o.xtype,o.name,cm.text -- 获得视图程创建语句 select o.xtype,o.name,cm.text from syscomments cm inner join sysobjects o on o.id=cm.i…
--1.查询某个表被哪些存储过程使用到 : select distinct object_name(id) from syscomments where id in (select object_id from sys.objects where type ='P') and text like'%TableName%' --2.查找那些过程对该表做了更新操作: select distinct object_name(id) from syscomments where id in(select…
1.获取所有数据库名 --SELECT Name FROM Master..SysDatabases ORDER BY Name -- 2.获取所有表名: --SELECT Name NAMEtemp,* FROM TEST..SysObjects Where XType='U' ORDER BY Name --表名 ----XType='U':表示所有用户表; ----XType='S':表示所有系统表; 3.获取所有字段名: SELECT Name FROM SysColumns WHER…
查询所给的表中值为空的总数 判断字段是否为空的sql语句 SELECT sex FROM id where sex is not NULL SELECT COUNT(*) t FROM id where sex is NULL UNION ALL SELECT COUNT(*) t FROM id WHERE cardid is NULL SELECT SUM(t) FROM (SELECT COUNT(*) t FROM id where sex is NULL UNION ALL SELE…
1.查询锁住表信息 show OPEN TABLES where In_use > 0; 2.查看进程 show processlist; 3.解开锁住的表 需要杀掉锁住表的相关进程Id. kill id 可使用 select concat('kill ',id,';') from information_schema.processlist where STATE like '%lock'; 注:information_schema表示系统数据库.. 结果: 将以上的结果复制到命令框中执行.…
1.查询实例中所有数据库 select name,database_id from sys.databases 2.查询数据库中所有表select TABLE_TYPE,TABLE_NAME from information_schema.tables order by TABLE_NAME select * from sysobjects where type='U' order by name(所有表)select * from sysobjects where type='SQ' orde…