Skip to content

Instantly share code, notes, and snippets.

@joshids
joshids / per database table size
Created September 27, 2016 07:44
Script to calculate table and index sizes for all databases that login has access to.
--sqlserver 2005 +
EXECUTE master.sys.sp_MSforeachdb
'USE [?];
select getdate() as snapdate,serverproperty(''MachineName'') svr,@@servicename sv, ''?'' _dbname, nomTable= object_name(p.object_id),p.partition_id,p.partition_number,
lignes = sum(
CASE
When (p.index_id < 2) and (a.type = 1) Then p.rows
Else 0
END
@joshids
joshids / Fix_Found_shared_references_to_a_collection.cs
Created July 27, 2015 12:01
How to get "Found shared references to a collection"
var coll = new UIRColl();
var u1 = new user();
//u1.uircolllection = coll;
u1.uircolllection = new UIRColl();
u1.uircolllection .AddRange(coll);
var u2 = new user();
//u2.uircolllection = coll;
u2.uircolllection = new UIRColl();
@joshids
joshids / Found_shared_references_to_a_collection
Created July 27, 2015 11:59
How to get "Found shared references to a collection
var coll = new UIRColl();
var u1 = new user();
u1.uircolllection = coll;
var u2 = new user();
u2.uircolllection = coll;
session.flush();