关于“手动重新生成注册表性能计数器”的问题
摘要:前阵子在安装SQL Server 2008时,提示注册表性能计数器有问题,看了微软提供的链接,但上面说的是适合windows 2000及2003的解决方案。后来,在一个网站看到有位兄弟为这个问题做了两个批处理文件,照做后果然解决了问题,十分感激那位兄弟,但由于那篇文件找不到了,在此无法注明出处,还望那位兄弟见谅。以下是用于解决xp下“手动重新生成注册表性能计数器”的问题的两...
阅读全文
posted @
2009-06-18 21:45
Good life
阅读(1055)
推荐(0)
select...count()
摘要:declare @t table( c varchar(10));insert @tselect *from (select 'A' as c union allselect 'B' union allselect 'B' union allselect null union allselect null) t;select count(*) from @t;select count(c) fro...
阅读全文
posted @
2009-03-04 11:23
Good life
阅读(224)
推荐(0)
在t-sql 中使查詢結果按照自定義的字串排序
摘要:-- sql serverselect idfrom(select '1' as id union allselect '2' union allselect '3' union allselect '4' union allselect '5' ) torder by case when charindex(id, '3, 2, 4, 1') = 0 then 1000000 else char...
阅读全文
posted @
2008-12-04 12:39
Good life
阅读(219)
推荐(0)
纵转横
摘要:-- take AdventureWorks database as exampledeclare @fromDate datetime, @dueDate datetimeselect @fromDate = '2003-09-01', @dueDate='2003-09-16'select top 100 a.ProductId, convert(nvarchar(10), b.OrderDa...
阅读全文
posted @
2008-11-29 11:44
Good life
阅读(217)
推荐(0)
字符串处理--根据key值进行replace
摘要:1、需求: t1表: id--------------------------1,2,3,4,5 t2表: id name----------- ----------1 John2 Robot3 Mary 期望得到结果: 1John,2Robot,3Mary,4,5 2、实现 方法一: Code highlight...
阅读全文
posted @
2008-08-06 11:10
Good life
阅读(657)
推荐(0)
BCP xp_cmdshell
摘要:---------------------- 从现有表导出结果 ---------------------- -- 将AdventureWorks.HumanResources.Employee表的数据导出到C:\test.xls EXEC master..xp_cmdshell ' BCP "select * from AdventureWorks.HumanResources.Employee...
阅读全文
posted @
2008-08-05 11:40
Good life
阅读(338)
推荐(0)
Split函数(SQL Server)
摘要:-- 建立函数 create function dbo.fn_split ( @originalString nvarchar(200), @splitter nvarchar(1) ) returns @temp table ( id int identity(1, 1) primary key, value nvarchar(100) ) as begin decla...
阅读全文
posted @
2008-08-05 11:17
Good life
阅读(408)
推荐(0)
提取汉字的函数(SQL Server)
摘要:----如果该对象已存在则先删除 if object_id('fnExtractChinese') is not null drop function fnExtractChinese GO ----创建字符串提取函数 create function fnExtractChinese(@string varchar(100)) returns varchar(100) as begin...
阅读全文
posted @
2008-08-05 11:10
Good life
阅读(418)
推荐(0)
通过数据库编程进行递归(SQL Server)
摘要:一、用于测试数据及其结构和生成该测试数据的sql语句如下: 1、测试数据 nodeId parentId ---------- ---------- A01 A A02 A A03 A A0101 A01 A0102 A01 A0201 A02 A0202 A02 B01 B B02 ...
阅读全文
posted @
2008-08-05 10:48
Good life
阅读(310)
推荐(0)
关于OpenDataSource, OpenRowSet
摘要:一、SQL Server(这里测试的是sql server2005;以下6条语句实现的功能均是“取AdventureWorks.HumanResources.Employee表的第一条记录”) 、使用OPENROWSET 1. MSDASQL驱动 SELECT TOP 1 * FROM OPENROWSET('MSDASQL', 'DRIVER={SQL Server};SERVER=192....
阅读全文
posted @
2008-07-08 14:33
Good life
阅读(768)
推荐(0)