随笔分类 - SQL Server
摘要:##查询下级(包括自身) WITH TempTable AS ( SELECT ID, Name, ParentID FROM table WHERE ID in (25) UNION ALL SELECT a.ID,a.Name,a.ParentID FROM TempTable JOIN tab
阅读全文
摘要:数据库 C# int int32 text string bigint int64 binary System.Byte[] bit Boolean char string datetime System.DateTime decimal System.Decimal float System.Do
阅读全文
摘要:通用方法 | 函数 | 描述 | | | | | GetDate( ) |返回系统目前的日期与时间| |DateDiff (interval,date1,date2)| 以interval 指定的方式,返回date2 与date1两个日期之间的差值 date2-date1| |DateAdd (in
阅读全文
摘要:方法1: truncate table 你的表名 //这样不但将数据全部删除,而且重新定位自增的字段 方法2: delete from 你的表名 dbcc checkident(你的表名,reseed,0) //重新定位自增的字段,让它从1开始 方法3: 如果你要保存你的数据,介绍你第三种方法,by
阅读全文
摘要:sql server数据库截取字段中字符串,然后通过截取内容连接另一个表查询数据: SELECT *,'显示列' = STUFF(( SELECT ',' + b.列名 FROM b where PATINDEX('%,' + RTRIM(序号) + ',%',',' + a.列名 + ',')>0
阅读全文
摘要:方法一 select 外键 from 表 where 字段B=1 OR 字段B=2 方法二 select 外键 from 表 where 字段B in(1,2)
阅读全文

浙公网安备 33010602011771号