SqlServer 查询sql执行时间
在查询分析器中输入以下内容:
set statistics profile on
set statistics io on
set statistics time on
go
go
set statistics profile off
set statistics io off
set statistics time off
相关文档:
1.建表语句:create table
用法: create table 表的名字 (字段1, 字段2,。。。。)
举例:例如创建一个学生成绩表,包含的字段有,学生id,姓名,性别,班级,成绩create table score(
create table score(
sid nvarchar(10) primary key,
sname nvarchar(10) not null,
sex nvarchar(2),
sc ......
一、选择最有效率的表名顺序(只在基于规则的优化器中有效)
ORACLE的解析器按照从右到左的顺序处理from子句中的表名,因此from子句中写在最后的表(基础表 driving table)将被最先处理. 在from子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表.当ORACLE处理多个表时, 会运用排序及合并的方式连接它们 ......
--1.在目标服务器上建立如下对象(被同步的服务器)
if exists (select * from dbo.sysobjects where id = object_id(N'[sys_syscomments_bak]') and OBJECTPROPERTY(id, N'IsUserTable')   ......
----start
前面,我们介绍了 尽量避免在SQL语句的WHERE子句中使用函数,因为这样做会使该字段上的索引失效,影响SQL语句的性能。基于同样的道理,我们也应该避免使用LIKE。考虑下面的情况:
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---姓名
MYNUMBER VARCHAR(18)---身份证号码
);&nb ......