随笔分类 -  [37] SQL Server

摘要:以下结果为 0, 而不是0.01select null as column1 into #table1update #table1 set column1=0.01select * from #table1 阅读全文
posted @ 2009-05-20 12:43 emanlee 阅读(377) 评论(0) 推荐(0)
摘要:SELECT cast(SERVERPROPERTY('productversion') as nvarchar(100)) as a, cast(SERVERPROPERTY ('productlevel') as nvarchar(100)) as b, cast(SERVERPROPE... 阅读全文
posted @ 2009-05-18 20:17 emanlee 阅读(502) 评论(0) 推荐(0)
摘要:The Database Publishing Wizard enables the deployment of SQL Server 2005 databases (both schema and data) into a shared hosting environment on either ... 阅读全文
posted @ 2009-04-29 23:40 emanlee 阅读(366) 评论(0) 推荐(0)
摘要:数据类型在 Microsoft® SQL Server™ 中,每个列、局部变量、表达式和参数都有一个相关的数据类型,这是指定对象可持有的数据类型(整型、字符、money 等等)的特性。SQL Server 提供系统数据类型集,定义了可与 SQL Server 一起使用的所有数据类型。下面列出系统提供... 阅读全文
posted @ 2009-04-06 20:23 emanlee 阅读(351) 评论(0) 推荐(0)
摘要:ISNULL是判断是否为NULL而NULLIF是把值换成NULLCOALESCE是用别的来代替NULLSELECT employee_id,first_name,last_name,NULLIF (SALES_QUOTA,-1) as QuotaFROM employees就是把-1变成 NULLC... 阅读全文
posted @ 2009-04-06 19:17 emanlee 阅读(1837) 评论(0) 推荐(0)
摘要:http://www.red-gate.com/products/SQL_Refactor/index.htmhttp://orafaq.com/utilities/sqlformatter.htmhttp://mikeschinkel.com/blog/anyoneknowofatsqlcodef... 阅读全文
posted @ 2009-04-05 00:04 emanlee 阅读(1718) 评论(0) 推荐(0)
摘要:Sql Server中的日期与时间函数 1. 当前系统日期、时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值 例如:向日期加上2天 select dateadd(day,2,'2004-10-15') --返回:20... 阅读全文
posted @ 2009-03-12 18:53 emanlee 阅读(238) 评论(0) 推荐(0)
摘要:破解SQL Prompt 3.9的几步操作关于SQL Prompt 的破解文章园子里已经有不少人发过了。破解思路我也不想重复,不知道的可以参考:http://www.cnblogs.com/jintan/archive/2008/06/16/1223282.html官方下载地址是:http://do... 阅读全文
posted @ 2008-11-14 23:02 emanlee 阅读(3193) 评论(0) 推荐(0)
摘要:版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://www.cnblogs.com/jintan/archive/2008/06/13/1220365.html 从07年开始就一直用SQL Prompt,以及Red-Gate... 阅读全文
posted @ 2008-11-14 22:23 emanlee 阅读(808) 评论(1) 推荐(0)
摘要:错误信息: Server Error in '/xxxxx' Application.Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have oc... 阅读全文
posted @ 2008-11-11 10:41 emanlee 阅读(5071) 评论(0) 推荐(1)
摘要:作者: DrillChina, 出处:blog, 责任编辑: 李书琴, 2008-07-08 10:05 在SQL Server的性能调优中,有一个不可比拟的问题:那就是如何在一段需要长时间的代码或被频繁调用的代码中处理临时数据集?表变量和临时表是两种选择。 在SQL Server的性能调优... 阅读全文
posted @ 2008-11-01 11:04 emanlee 阅读(1069) 评论(0) 推荐(0)
摘要:SQL Server 2005 行列转换有用SQL写过交叉报表的,往往都比较头痛,还好现在SQL2005中提供了新的PIVOT操作符,可以很简单地写出交叉数据查询。正好前两天在研究ORACLE最新的11G版本提供的新特性,发现ORACLE11G也同样推出这个新PIVOT,而且语法格式也几乎是一样的,... 阅读全文
posted @ 2008-10-21 10:26 emanlee 阅读(612) 评论(0) 推荐(0)
摘要:创建表:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->SETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGOCREATET... 阅读全文
posted @ 2008-10-07 12:26 emanlee 阅读(12108) 评论(1) 推荐(3)
摘要:使用临时表:select id=identity(int,1,1),value into #temp from YourTable select * from #temp drop table #temp 取得第11到20行记录:select IDENTITY(int,... 阅读全文
posted @ 2008-09-22 22:27 emanlee 阅读(5071) 评论(0) 推荐(0)
摘要:--获得禁用所有外键约束的语句select 'ALTER TABLE [' + b.name + '] NOCHECK CONSTRAINT ' + a.name +';' as 禁用约束 from sysobjects a ,sysobjects b where a.xtype ='f' and ... 阅读全文
posted @ 2008-09-22 21:48 emanlee 阅读(5171) 评论(0) 推荐(0)
摘要:经常遇到这样的情况,要取得所有客户的最新交易记录,读取网站所有浏览者最后一次访问时间。一个客户只读取最新的一次记录,相同,大部分的人首先想到的就是排除所有记录,相同的只取一条。用distint,但是distint只能取到一个字段的值。所以使用distint就不能读取 出所有的情况。下面是一条正确的语... 阅读全文
posted @ 2008-09-19 10:44 emanlee 阅读(1453) 评论(1) 推荐(1)
摘要:运行平台SQL SERVER 2005一、准备工作:1.建立一个WINDOWS 用户,设置为管理员权限,并设置密码,作为发布快照文件的有效访问用户。2.在SQL SERVER下实现发布服务器和订阅服务器的通信正常(即可以互访)。打开1433端口,在防火墙中设特例3.在发布服务器上建立一个共享目录,作... 阅读全文
posted @ 2008-05-24 16:36 emanlee 阅读(744) 评论(2) 推荐(0)
摘要:当登录SQL Server 2005时可能碰到错误: 'No Process is on the Other End of the Pipe'。解决方法:(1)Open up SQL Server Suraface Area Configuration tool by clicking Start ... 阅读全文
posted @ 2008-05-09 19:20 emanlee 阅读(3105) 评论(0) 推荐(0)
摘要:查询及删除重复记录的方法 1、查找表(people)中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select*frompeoplewherepeopleIdin(selectpeopleIdfrompeoplegroupbypeopleIdhavingcount(peopleI... 阅读全文
posted @ 2008-02-26 18:59 emanlee 阅读(432) 评论(0) 推荐(0)
摘要:这里对 SQL Server 字符串函数进行分门别类地列出,便于查阅和记忆,相信大家都在其它方面有高深的编程基础,从字面上来说大家都知道这些函数的意义,就不对这些函数作过多的解释了,主要谈些经验,具体请参见联机丛书。ASCII(character_expression) 返回最左端字符的 ASCII... 阅读全文
posted @ 2008-01-28 10:57 emanlee 阅读(1010) 评论(0) 推荐(0)