blueskyc's blog
永不放弃

随笔分类 -  SQL 2005

实现SQL2005中的row_number()函数
摘要:可以通过以下sql语句来实现row_number()函数相同的效果但是必须要id不重复,如果你能找到你的表中的几个字段合起来永远不会重复,就能行。运用颠倒算法:strSql.Append("SELECT g.id, g.sid, g.active_date, g.sn, h.reg_key, h.active_code FROM "); strSql.Append(" (SELECT f.id, f.sid, f.active_date, sn.sn FROM ");       // maximumRows每页显示行数 strSql.AppendFormat("(SELECT TOP 100 阅读全文
posted @ 2010-04-09 17:36 Cherry Chen 阅读(274) 评论(0) 推荐(0)
存储过程循环插入数据
摘要:存储过程循环插入数据代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Declare @Count int;declare @MaxCount int;declare @id tinyint;declare @name char(40);declar... 阅读全文
posted @ 2010-01-11 14:37 Cherry Chen 阅读(4922) 评论(0) 推荐(0)
SQLserver中用convert函数转换日期格式
摘要:SQL Server中文版的默认的日期字段datetime格式是yyyy-mm-dd Thh:mm:ss.mmm 例如: select getdate() 2004-09-12 11:06:08.177 整理了一下SQL Server里面可能经常会用到的日期格式转换方法: 举例如下: select CONVERT(varchar, getdate(), 120 ) 2004-09-12 11:06... 阅读全文
posted @ 2009-12-11 15:07 Cherry Chen 阅读(835) 评论(0) 推荐(0)
SQL Server中删除重复数据的几个方法
摘要:SQL Server中删除重复数据的几个方法 作者: 佚名, 出处:IT专家网论坛, 责任编辑: 包春林, 2009-02-23 04:00 数据库的使用过程中由于程序方面的问题有时候会碰到重复数据,重复数据导致了数据库部分设置不能正确设置…… 方法一 declare @max integer,@id integer ... 阅读全文
posted @ 2009-03-12 11:40 Cherry Chen 阅读(326) 评论(0) 推荐(0)