虚拟机上MSSQL连接的问题
在电脑上装了个虚拟机,本机装了个MSSQL2000,在虚拟机也装了个MSSQL2000,但是当连接虚拟机上的MSSQL,SQL提示出错,无法连接,觉得很奇怪,因为IP地址是不同的,最后想到了个办法,因为是一台电脑,所以端口1433只有一个,本机占了1433,那么虚拟机就没法用了,想到就做,把虚拟机的端口改成了1500。重启电脑,但是还是不能连接,最后想到了个办法,将连接主机更改为 TCP:10.0.0.4,1500 my god,搞定了,可以连上去了。。(注意只是在查询分析器是这样连接的)
在企业管理器使用同样的方法,连不上服务器,郁闷。。正在想办法呢?
相关文档:
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。
2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如:
select id from t where num is null
可以在num上设置默认值0,确保表中num列没有null值,然后这样查询:
select id ......
从mssql6.5开始,微软提供了两个不公开,非常有用的系统存储过程sp_MSforeachtable和sp_MSforeachdb,用于遍历某个数据库的每个表和遍历DBMS管理下的每个数据库。
我们在master数据库里执行下面的语句可以看到两个proc详细的代码
use master
exec sp_helptext sp_MSforeachtable
exec sp_helptext sp_Msforeachdb
sp_M ......
--字段添加说明
EXEC sp_addextendedproperty 'MS_Description', '要添加的说明', 'user', dbo, 'table', 表名, 'column', 列名
--删除字段说明
EXEC sp_dropextendedproperty 'MS_Description', 'user', dbo, 'table', 表名, 'column', 字段名
--查看字段说明
SELECT
[Table Name] = i_s.TAB ......
How is MSSQL using memory?
http://www.sqlhacks.com/Administration/Memory-Usage
Memory is one the most important factor affecting MSSQL performance.
As an administrator, you should be monitoring the memory
regularly. When Microsoft SQL Server runs out of memory, it will use
virtual memory: ie: ......
Sql2005中使用ow_number() partition进行分组实验,
SQL:
select * from stu
select id,row_number() over (partition by snm order by id) from stu
结果:
id snm
----------------
111 111V
111 111W
222 222N
333 3123
444 3123
555 3123
666 3232
777 3232
--分组后的结果
id &n ......