2012年12月6日

SQL函数

摘要: ROW_NUMBER()over(order by getdate()) 序号distinct 踢出重复获取日期 当年第一天(2012-01-01)dateadd(month, -MONTH(@jsrq)+1, dateadd(DAY, -day(@jsrq)+1, @jsrq)) 阅读全文

posted @ 2012-12-06 12:18 binmail2012 阅读(96) 评论(0) 推荐(0)

case when

摘要: select len(qybh),casewhen len(qybh)=1 then 1 when len(qybh)=5 then 5 else 0 endfrom Company 阅读全文

posted @ 2012-12-06 12:14 binmail2012 阅读(112) 评论(0) 推荐(0)

获取数据库表结构

摘要: SELECT 表名=case when a.colorder=1 then d.name else '' end, 表说明=case when a.colorder=1 then isnull(f.value,'') else '' end, 字段序号=a.colorder, 字段名=a.name, 是否种子标识=case when COLUMNPROPERTY( a.id,a.name,'IsIdentity')=1 then 'yes'else '' end, 主键=case when exis 阅读全文

posted @ 2012-12-06 12:11 binmail2012 阅读(209) 评论(0) 推荐(0)

SQL游标

摘要: declare @qybh nvarchar(255)--这里假设你两个字段的字段类型--定义游标DECLARE mycursor CURSOR FOR select qybhfrom Companygroup by qybhhaving count(*) > 1--打开游标open mycursor--指定游标fetch next from mycursor into @qybh--当存在数据WHILE @@FETCH_STATUS = 0 BEGIN print @qybh fetch next from mycursor into @qybhEND--释放游... 阅读全文

posted @ 2012-12-06 12:09 binmail2012 阅读(123) 评论(0) 推荐(0)

GridControlExtension

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using DevExpress.Utils.Menu;using DevExpress.XtraGrid.Columns;using DevExpress.XtraGrid.Menu;using System.Windows.Forms;namespace InternalManagement.Tools{ public static class GridViewExtension { private... 阅读全文

posted @ 2012-12-06 12:02 binmail2012 阅读(178) 评论(0) 推荐(0)

sqlhelper

摘要: using System;using System.Collections.Generic;using System.Collections;using System.Text;using System.Data;using System.Data.SqlClient;public class sqlhelper{ /// <summary> /// 哈希表用来存储缓存的参数信息,哈希表可以存储任意类型的参数。 /// </summary> private static Hashtable parmCache = Hashtable.Synchronized(new H 阅读全文

posted @ 2012-12-06 11:57 binmail2012 阅读(130) 评论(0) 推荐(0)

导航