摘要:1. 因为项目比较小,数据库计划里的每天备份都是80M左右,突然看到猛增到500M,然后每天激增,现在都到5G了,恐怖。。。。 趁大家没有发现之前赶快解决。 2. 查看数据库大小,单位是M select name, convert(float,size) * (8192.0/1024.0)/1024
阅读全文
摘要:sqlserver分页常用的有两种: 1.利用row_number set statistics time on; -- 分页查询(通用型) select top pageSize * from (select row_number() over(order by sno asc) as rownu
阅读全文
摘要:SQL Server遍历表的几种方法 SQL Server遍历表的几种方法 阅读目录 使用游标 使用表变量 使用临时表 在数据库开发过程中,我们经常会碰到要遍历数据表的情形,一提到遍历表,我们第一印象可能就想到使用游标,使用游标虽然直观易懂,但是它不符合面向集合操作的原则,而且性能也比面向集合低。当
阅读全文
摘要:select name from tablename group by name having min(fenshu)>80 或者 select distinct name from tablename where name not in (select distinct name from tab
阅读全文
摘要:using System; using System.Collections; using System.Collections.Specialized; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Data.Common; using System.Collec...
阅读全文
摘要:1 public abstract class DBHelper 2 { 3 public static string connectionString = @"DATA SOURCE=.\sqldata;UID=sa;PWD=bkin123;DATABASE=bkintest";//ConfigurationManager.ConnectionStrings...
阅读全文
摘要:select count(case 分数字段 when 100 then 1 end) as [满分],count(case when 分数字段 between 90 and 99 then 1 end) as[90-99分],count(case when 分数字段 between 80 and
阅读全文
摘要:1 public abstract class SqlHelper 2 { 3 //数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库. 4 public static string connectionString = ConfigurationManager.ConnectionS...
阅读全文
摘要:1.拷贝mdf ldf文件到某个文件夹下 2.打开SQL执行语句: 3.如果出现拒绝访问,则设置下mdf 和 ldf的文件安全。
阅读全文
摘要:感谢 http://bbs.csdn.net/topics/391048578?page=1 解决办法: 方法一已经验证,可以使用。 对应自己数据库: 现在只有一个用户视图,需要select 单位并排序,因为一个单位有多个用户
阅读全文
摘要:1. 一对多查询 查询departmentinfo字典下所有部门的人员数量 select * from departmentinfo a left join (select count(*) UserCount,UnitId from ReCharge where ReDate='2017-06-1
阅读全文