Can’t find that file?

Too many times I have needed to find a piece of code that calls a view, proc or table. If you are using any of Microsoft’s developer products you can do “Find in solution” but it takes a month. You can also go to the server, browse to the folder and click search only to get no results. Well, I have a solution.

Unix and Linux people may remember grep. Well, there is a windows version called Wingrep ( ). Install it. Use it. Find the files you need.

Zip – the easy way

Recently I had a reason to zip a folder on a regular basis (as in every night).  I discovered a great program called 7-zip.  This thing works AND has a command line interface and supports really groovy things like volumes.

Let’s say you need to zip all your SQL backups nightly but for obvious reasons you need the files to me no more than a certain size (my cloud drive only allows 2gig files).  Create a DOS batch file with the following code (replacing the paths with your paths) and schedule it to run each night.

del /Q D:\Backup\zip\*.*

c:\"program files"\7-zip\7z a -tzip -v700m d:\backup\zip\ d:\backup\sql\*.bak -aoa

It takes all the files in d:\backup\zip and deletes them. Then it zips everything in d:\backup\sql with the extension .bak into zip files with volume sizes of 700mb (which will, by the way, fit on a cd). How cool is that?

SQL and Today

sometimes it is handy to be able to use today’s date in T-SQL.  Sure, you have getdate() but it has minutes and seconds and stuff.  What if you  just want today?  Try this:
CREATE view dbo.v_today as
select convert(varchar(5),MONTH(getdate())) + '/' + convert(varchar(5),DAY(GETDATE())) + '/' + convert(varchar(5),YEAR(getdate()))
as Today

How do you use it?

select * from orders where orderdate >= ( select today from v_today);
select * from orders where orderdate < ( select today from v_today);

Yeah – I know it’s simple but so am I and it works.


What is a Toddism?

Me.  I develop custom business software.  Imagine, if you will, a corporate database with lots of thingies and doofers.  You need some more but really don’t want to replace the thingies you have.  I write custom thingies that may connect to your corporate database.  They may me brand new and require some database design. Whether you need SQL, ASP, PHP, .NET or some combination I can help.

Whatever the need, I can do the design and implementation.