摘要: select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')20040912110608select CONVERT(varchar(12) , getdate(), 111 )2004/09/12select CONVERT(varchar(12) , getdate 阅读全文
posted @ 2012-03-14 21:13 iewysdcwy 阅读(159) 评论(0) 推荐(0) 编辑
摘要: EG:SELECT TOP 5 md.ID,md.DepartName,md.OrganID,md.LastEditDate FROM mdDepartment md1 总经办 40 2009-06-24 16:21:52.4502 广告商务部 03 2009-06-24 16:22:02.8273 品牌商务部 02 2009-06-24 16:22:08.2804 客户发展部 04 2009-06-24 16:22:13.5305 增值三部 NULL 2009-11-05 14:20:31.750SELECT TOP 5 md.ID,md.DepartName,md.OrganID,md.L 阅读全文
posted @ 2012-03-14 21:12 iewysdcwy 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1.通过SQL拼写出要显示字符串:SELECT * ,(sa.AnswerContent+'<BR/>'+ISNULL(saaaa.XMLAnswerContent,'')) AS XMLAnswerContent2FROM SeAnswer saJOIN mdList ml ON sa.AnswerType=ml.[value]AND ml.[type]='AnswerType'AND sa.AnswerType = ISNULL(@AnswerType,sa.AnswerType)AND sa.AnswerContent LIKE 阅读全文
posted @ 2012-03-14 21:10 iewysdcwy 阅读(303) 评论(0) 推荐(0) 编辑
摘要: select t1.*,row_number() over(order by fname) fname1from tablename 阅读全文
posted @ 2012-03-14 21:09 iewysdcwy 阅读(248) 评论(0) 推荐(0) 编辑
摘要: DECLARE @ModelsXml XML,@ids VARCHAR(100)SET @ids='123@3,223@4,323@5'set @ModelsXml=' <root> <v><aa>'+REPLACE(REPLACE(@ids,',','</bb></v><v><aa>'),'@','</aa><bb>')+'</bb> </v> </ro 阅读全文
posted @ 2012-03-14 21:07 iewysdcwy 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 table1结构如下 2 id int 3 name varchar(50) 4 5 declare @id int 6 declare @name varchar(50) 7 declare cursor1 cursor for --定义游标cursor1 8 select * from table1 --使用游标的对象(跟据需要填入select文) 9 open cursor1 --打开游标10 11 fetch next from cursor1 into @id,... 阅读全文
posted @ 2012-02-29 10:14 iewysdcwy 阅读(197) 评论(0) 推荐(0) 编辑
摘要: --批量执行存储过程SELECT ROW_NUMBER() over(ORDER BY bo.orderno) RowNumber, bo.OrderNo,bo.OrderStatus INTO #aaaFROM bdOrder boJOIN mdDepartment md ON bo.DepartmentID=md.IDJOIN mdDepartment MD2 ON md.OrganID LIKE MD2.OrganID+'%'AND md2.ID=16AND bo.OrderDate>'2012-02-28'AND bo.OrderStatus IN 阅读全文
posted @ 2012-02-28 18:31 iewysdcwy 阅读(1316) 评论(0) 推荐(0) 编辑
摘要: create table tb(姓名 varchar(10),课程 varchar(10),分数 int)insert into tb values('张三','语文',74)insert into tb values('张三','数学',83)insert into tb values('张三','物理',93)insert into tb values('李四','语文',74)insert into tb values('李四','数学& 阅读全文
posted @ 2012-02-24 16:27 iewysdcwy 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 1. <td width="80px" align="right" valign="top" style="padding-top:5px;">效果: 阅读全文
posted @ 2012-02-24 16:26 iewysdcwy 阅读(116) 评论(0) 推荐(0) 编辑