As SQL professionals I’m sure many of you build up a library of SQL scripts that you take from project to project, right? Here’s a tip for those of you that have such a collection and want to make sure that you always have ready access to it.
I’m a big fan of all things sync-related and there are many tools on the market now that will sync the contents of a Windows folder to the cloud or around different machines; Dropbox is a popular one, as is Windows Live Mesh which I use and I also hear good things about SugarSync (they’re all free by the way). It doesn’t matter which one you use, the basic premise of these tools is that any file dropped into a monitored folder automatically gets copied up to a cloud store and whenever you buy/inherit a new machine simply installing the client will bring that stuff down for you. In short, its an ideal solution for always having access to your SQL script library.
Here’s a screenshot of the Windows Live Mesh client:
Notice that I have a folder called “Personal SQL Store” (I also have one for my Powershell scripts too). Its synced to two of my laptops and also to SkyDrive Synced Storage which is Windows Live’s name for the cloud store that I referred to earlier. Up at that cloud store I have ready access to the contents of that folder:
It makes it really simple to get to those folders from any computer in the world (although admittedly I have occasionally come a cropper thanks to some over zealous IT departments) and I’d highly recommend using a similar system if you have such a script library that you always need access to particularly if, like me, you’re always on the move around different client sites. Alternatively if you don’t have your own set of scripts I have the option to share my folder with up to nine people so if you want read-only access to my script library let me know.
UPDATE: Adam Machanic posted a comment that made me realise it was pretty stupid to invite you to share my script library without telling you what was in it. Hence:
- cdf.TitleCase - Returns Title Case Formatted String
- fnSplitWithCTE - take a delimited list of characters and return them as a dataset
- All Sessions
- Data cache usage per table
- DatawarehouseCleardown - Deletes all data from all tables in a database, respecting FKs.
- Discovering_tempdb_Stats – Various queries to return info about tempdb
- Get Index Fragmentation
- Get Table Row Counts
- Index information including column names
- Paul Randal myth - DDL Triggers are INSTEAD OF triggers
- Paul Randal myth - Null bitmap myth
- Split csv into a dataset using XML & XQuery
- tablestats – Stats for every table in a DB
- View all permissions
- csp_ToolRenameObjects2005 – Rename FKs, CHECK constraints, Indexes according to a defined naming convention. Work on SQL2005 and above
- dbo.csp_ToolIDAssignSurrogateKey – Assign/Reassign surrogate keys on a table
- sp_generate_inserts2005 – Generate inserts according to existing data in a table. Works on SQL2005 and above
- SqlClrToolkit – a suite of useful SQLCLR procs/functions. FIRST/LAST/MERGE aggregate functions, SafeDivision, RegexMatch, CountString, CapitaliseText, RemoveWhitespace, DynamicPivotSQL, Split, DynamicPivot, DirectoryInfo, RegistryInfo, FindChildTables, EnableDisableConstraints
- SSAS clearcache
Hopefully the names are self-explanatory enough!
Jezza101 left a comment below suggesting that I just zip the whole lot up and post it somewhere which is what I have done at: http://cid-550f681dad532637.office.live.com/self.aspx/Public/BlogShare/20101003/Personal%20SQL%20Store.zip
Hope this is useful!
Seems I may have made a bad choice in choosing Live Mesh. I have managed to add a few people but now every time I add someone I get this:
I’m waiting on a reply from Microsoft but in the meantime, plesae don’t ask me to add you because I won’t be able to. I shall come back and update this as and when I am able.