February 2008 Entries
Ever have to work on a database with a large number of views and you needed to search the content of the objects? Well, here's a query which will allow you to search inside your view objects:DECLARE @search VARCHAR(1000)SET @search = '[text]'SELECT c.[Text]FROM dbo.sysobjects AS vINNER JOIN dbo.syscomments c ON c.id = v.id AND CASE WHEN c.Number > 1 THEN c.Number ELSE 0 END = 0WHERE v.type = 'V' AND c.[Text] LIKE '%' + @search + '%'Just set the value of @search to the value you'd like to find.This was very useful to me as I was trying...
Frustrated by the inability to script SQL Server 2005 objects with BOTH a CREATE and DROP statement? Generally, I write all my scripts with both statements and then save them and include them in source control, so this hasn't really been a problem for me. But I recently started working on a new project where stored proceedures haven't been maintained in source control and the generate scripts tool is used to sync changes between environments and there are a lot of stored procedures.So I decided to google for a way to get around this. Greatfully the SqlTeam has created an...
I've been playing with the new ASP.NET MVC Framework CTP which uses anonymous types to build url paths which allow you to change the path format. I'm really enjoying the control and the separation of concerns you get.As I've been writing my MVC application I needed to maintain a parameter in all urls for authenticated users but I didn't want to have to manually include the paramter in every url, form action and redirect. So I wrote some extension functions which wrap the Html and Url helper class methods used to build urls (ActionLink, Form and Url). Additionally, I wrote...