July 2010 Entries
Why? Well, sometimes you just want it all in one table.
create
table #t (
tablename sysname,row_count int,
reserved varchar(50),data varchar(50),
index_size varchar(50),unused varchar(50))
exec
sp_msforeachtable
'insert #t exec sp_spaceused ''?'''
select
*
from #t
drop
table #t
Question: how do I regain sysadmin role for myself if I am a local admin, but not a sql sysadmin currently. This scenario can happen for a variety of reasons, but if you are the owner and administrator of a box, how do you get to where you can manage it again? It's pretty simple. Basically stop sql, then start it in single user mode, then add yourself, reset sa, whatever. A sample script is below. This script makes several assumptions.
Your server doesn't take longer than 10 seconds to start, otherwise modify the sleep line (or just do this manually...
So I am a huge fan of LINQPad. I use it all the time for ad hoc data processing mostly because of the .Dump() method which allows me to copy and paste something a little prettier than what I get outta mgmt studio or a simple command line processor. It's really pretty much the same to me, but for some reason normal people seem *wayyyyy* happier when they get a little blue box with some lines instead of just text with tabs or commas =P
Anyway, I was fixing to import some data from a file and I was joining it...