查询分页:语句1性能提升10倍多,仅仅是由于多了个topkeyword,非常不理解啊!!!! 1.查询时间1s内,r_object_id主键 select top 100 * from ( select all doc.r_object_id "objid",doc.name,doc.number, ...
分类:
其他好文 时间:
2017-04-18 12:26:32
阅读次数:
161
脚本方式删除表 if exists (select 1 from sysobjects where id = object_id('yxm') and type = 'U') drop table yxmgo 建表 create table users( id integer not null, c ...
分类:
数据库 时间:
2017-04-15 14:39:52
阅读次数:
164
DECLARE @tableName NVARCHAR(50)= 'home'; IF OBJECT_ID(N'TableColumnMaxLen', N'U') IS NULL BEGIN CREATE TABLE TableColumnMaxLen ( TableName NVARCHAR(50... ...
分类:
其他好文 时间:
2017-04-12 03:06:51
阅读次数:
283
姓名 课程 分数 张三 语文 74 张三 数学 83 张三 物理 93 李四 语文 74 李四 数学 84 李四 物理 94 想变成(得到如下结果): 姓名 语文 数学 物理 李四 74 84 94 张三 74 83 93 create table sc(姓名 varchar(10),课程 varc ...
分类:
数据库 时间:
2017-04-10 00:26:23
阅读次数:
291
IF OBJECT_ID('tempdb..#TB_TEMP_SPACE') IS NOT NULL DROP TABLE #TB_TEMP_SPACE GO CREATE TABLE #TB_TEMP_SPACE( NAME VARCHAR(500) ,ROWS INT ,RESERVED VAR... ...
分类:
数据库 时间:
2017-04-05 16:06:25
阅读次数:
176
IF OBJECT_ID('area','U') is not null DROP TABLE area; CREATE TABLE area ( areaid int NOT NULL, areaname varchar(50) DEFAULT NULL, parentId int DEFAULT... ...
分类:
数据库 时间:
2017-04-04 10:56:32
阅读次数:
1548
sybase 脚本删除存储过程 if exists (select 1 from sysobjects where id = object_id('P_add_user') and type = 'P') drop procedure P_add_usergo ...
分类:
数据库 时间:
2017-04-03 21:13:15
阅读次数:
157
SQL游标应用 if object_id('tempdb..#test0001') is not null drop table #test0001 物料临时表create table #test0001(ItemCode nvarchar(30) 物料代码 ,SL DEC(19,3) 物料所需数量 ...
分类:
数据库 时间:
2017-04-02 10:21:26
阅读次数:
255
T_SQL 将一列多行数据合并为一行 SQL Server在进行数据迁移和报表处理的时候会遇到将一列多行数据拼接为一个字符串的情况,为了处理这个问题,在网上找了一些相关的资料,提供两种方法,供遇到类似问题的朋友们参考,也借此加深自己的印象。 Table:SC Student Course 张三 大学 ...
分类:
数据库 时间:
2017-03-27 19:44:04
阅读次数:
380
新建临时表字段id,向临时表里插入1,2,3,4,5,6 if object_id('tempdb..#test') is not null drop table #test create table #test(id int)insert into #test(id)values(1),(2),( ...
分类:
数据库 时间:
2017-03-24 22:49:22
阅读次数:
737