|
|
January 2008 Blog Posts
Hi kids... Here's a hot action script for truncating all the tables in your SQL 2005 db for you. Please post your comments, changes, etc. and I'll update this throughout: select distinct t.table_schema + '.' + t.table_name as [table] , case when tc.constraint_type = 'FOREIGN KEY' then 1 else 2 end as [order]into #master_tblfrom information_schema.tables tinner join information_schema.table_constraints tc on tc.table_schema = t.table_schema and tc.table_name = t.table_namewhere t.table_type = 'BASE TABLE'and tc.constraint_type like '% KEY'order by 2alter table #master_tbladd idx bigint identity(1,1)select *into #kfrom #master_tblselect *into #rkfrom #kwhile ((select count(*) from #k) > 0)begin declare @table varchar(1024) declare @idx bigint select top 1 @table = [table] , @idx = idx from #k exec ('alter table ' + @table + ' nocheck constraint all') delete from #k where idx = @idxenddrop table #kselect *into #tfrom #master_tblwhile ((select count(*) from #t) > 0)begin declare @tidx bigint declare @ttable varchar(1024) select top 1 @tidx = idx , @ttable = [table] from #t order by [order] begin try exec('truncate table ' + @ttable) print @ttable + ' purged' end try begin catch print @ttable + ' could not be purged.' end catch delete from #t where idx = @tidxenddrop table #twhile ((select count(*) from #rk) > 0)begin declare @ktable varchar(1024) declare @kidx bigint select top 1 @ktable = [table] , @kidx = idx from #rk exec ('alter table ' + @ktable + ' with check check constraint all') delete from #rk where idx = @kidxenddrop table #rkdrop table #master_tblCheers...
Greetings, Been playing around with Reflection a bit. I wanted to determine if any of an assembly's dependencies have been loaded from the GAC or not. Here's the code snippet for you to play around with: { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode...
( this post has been blanked out, due to stupidity...)~zagnut
Archives
- September, 2011 (1)
- June, 2011 (2)
- February, 2011 (1)
- January, 2011 (2)
- December, 2010 (1)
- October, 2010 (1)
- September, 2010 (2)
- August, 2010 (3)
- July, 2010 (5)
- May, 2010 (1)
- April, 2010 (1)
- December, 2009 (1)
- November, 2009 (1)
- October, 2009 (2)
- September, 2009 (2)
- August, 2009 (2)
- July, 2009 (1)
- June, 2009 (1)
- May, 2009 (3)
- April, 2009 (4)
- March, 2009 (3)
- February, 2009 (3)
- January, 2009 (3)
- December, 2008 (1)
- November, 2008 (2)
- October, 2008 (4)
- September, 2008 (1)
- August, 2008 (1)
- July, 2008 (3)
- June, 2008 (3)
- May, 2008 (4)
- April, 2008 (1)
- March, 2008 (2)
- February, 2008 (1)
- January, 2008 (3)
- December, 2007 (3)
- September, 2007 (1)
- August, 2007 (1)
- June, 2007 (1)
- May, 2007 (2)
- February, 2007 (1)
- December, 2006 (2)
- November, 2006 (4)
- September, 2006 (1)
- August, 2006 (1)
- May, 2006 (3)
Post Categories
| |
| 30 | 31 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | 11 | 12 | | 13 | 14 | 15 | 16 | 17 | 18 | 19 | | 20 | 21 | 22 | 23 | 24 | 25 | 26 | | 27 | 28 | 29 | 30 | 31 | 1 | 2 | | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|