Roy Ashbrook

let go or be dragged
posts - 198, comments - 29, trackbacks - 8

July 2010 Entries

sp_spaceused for all the tables in your database in one table

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

posted @ Thursday, July 29, 2010 11:13 PM | Feedback (0) |

How to regain administrative access to your own sql server

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...

posted @ Thursday, July 29, 2010 1:10 PM | Feedback (0) |

ah yes…. LINQ is case sensitive….

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...

posted @ Tuesday, July 20, 2010 2:29 PM | Feedback (0) |

Powered by: