随笔分类 -  SQL

Azure SQL 列出所有表空间大小
摘要:select schema_name(tab.schema_id) + '.' + tab.name as [table], cast(sum(spc.used_pages * 8)/1024.00 as numeric(36, 2)) as used_mb, cast(sum(spc.total_ 阅读全文

posted @ 2021-08-02 12:01 HelloHongfu 阅读(69) 评论(0) 推荐(0)

不小心让数据库死锁了,网上找办法解决
摘要:SELECT SPID = er.session_id ,Status = ses.status ,[Login] = ses.login_name ,Host = ses.host_name ,BlkBy = er.blocking_session_id ,DBName =DB_Name... 阅读全文

posted @ 2015-05-27 16:39 HelloHongfu 阅读(463) 评论(0) 推荐(0)

SQL Server 2012 从备份中还原数据库
摘要:1.首先把原数据库备份,检查原数据库的日志文件是否太大,如果过于大应该先收缩数据库日志 2.把备份的数据库文件在目标SQL Server还原,点击数据库,选择“还原文件或文件组” 3.如果需要修改还原目标数据的文件位置,先点生成脚本。 4.在脚本中修改要还原目标数据库的存放位置 5.Example 阅读全文

posted @ 2013-10-25 10:30 HelloHongfu 阅读(1027) 评论(0) 推荐(0)

CRM 2011 组织关系树查询
摘要:declare @username nvarchar(20),@id nvarchar(50) set @username='李帅'; select @id=businessunitid from systemuser where fullname=@username; select name ,parentbusinessunitidname from businessunit where businessunitid=@id;WITH StepCTE AS (SELECTbusinessunitid,parentbusinessunitid, parentbusinessu 阅读全文

posted @ 2013-04-03 10:26 HelloHongfu 阅读(198) 评论(0) 推荐(0)

导航