行列转换,将列数据转换为字符串输出 ) SET @center_JZHW = ( SELECT DISTINCT STUFF( ( SELECT ',' + ce_code FROM ap_center WITH ( NOLOCK ) WHERE CE_PROVINCE = '浙江省' ORDER BY ce_code , , '') AS jzhw FROM ap_center t) SELECT @center_JZHW Function写法 ) SET @ret = '' SELECT @…
ORACLE根据账号查询每张表数据量: select t.table_name,t.num_rows from user_tables t ORDER BY NUM_ROWS DESC; SQL SERVER查询总数据量: SELECT SUM(记录条数) AS 总记录数 FROM (SELECT TOP (10000) a.name AS 表名, MAX(b.rows) AS 记录条数 FROM sys.sysobjects AS a INNER JOIN sys.sysindexes AS…
来自:http://topic.csdn.net/u/20080704/08/b2b8c42f-b0d6-4cda-98b1-6e4a279b4ff8.html 感谢楼主 函数 SQLServer和Oracle的常用函数对比 1.绝对值 S:select abs(-1) value O:select abs(-1) value from dual 2.取整(大) S:select ceiling(-1.001) value O:select ceil(-1.001) value fro…
Select 用途: 从指定表中取出指定的列的数据 语法: SELECT column_name(s) FROM table_name 解释: 从数据库中选取资料列,并允许从一或多个资料表中,选取一或多个资料列或资料行.SELECT 陈述式的完整语法相当复杂,但主要子句可摘要为: SELECT select_list [ INTO new_table ] FROM table_source [ WHERE search_condition ] [ GROUP BY group_by_expres…