sp_GetLastBackup
This will get the last date a database was backuped. It allows you to report this date on all databases on a server, or pass in a db name, and it'll report the date that db was last backed up
2002-03-07
443 reads
This will get the last date a database was backuped. It allows you to report this date on all databases on a server, or pass in a db name, and it'll report the date that db was last backed up
2002-03-07
443 reads
I use this SP to return full directory information into a table. FilePath, FileName, Filedate and FileSize are parsed from a 'dir /n/on/-c ' command. FilesInDir is the table created. usage: exec LoadFileDetailsIntoTable 'c:\winnt'select * from FilesInDir where filesize > 100000select min(fileDate) from FilesInDirThe Return Code will equal the number of files found.
2002-03-05
467 reads
spGetFieldsExists takes a tablename and a field name, and checks if that field exists in that table.It simply returns 0 or 1 (false or true).
2002-03-05
170 reads
spFindTableInfo is a great proc for finding info about your database. It will accept parameters like tablename, fieldname, size, datatype. So you can run it with no params, and it'll report every table, every field in those tables, and the size, datatype and whether its nullable or not. You can filter it by Table name […]
2002-03-05
380 reads
spDropField does exactly the opposite of spAddField. It checks for existence, then drops it, if it does exist.
2002-03-05
144 reads
spAddField is the proc I use to add all fields to the db in our upgrade scripts. With this proc, you pass it the tablename, fieldname, datatype, and null or not null. This will call spGetFieldsExists and see if the fields exists or not. If it does, spAddField will drop that column. Then it readds […]
2002-03-05
221 reads
Pass a datetime value and receive back a formatted string. Much like the Format$ function in Visual Basic.I put this together to provide a date string to add to filename. Also handy when you are creating text files that require datetime data to be output in weird character formats like yyddmm or yyyymm.eg: fnDate2Char(GetDate(), 'dmy', […]
2002-02-27
830 reads
Andy read this book recently and gave it a great review. Even though it's not a SQL book! Seriously, take a look at the review. It's a good book that is fun to read.
2002-02-26
3,275 reads
This script is very helpful for anyone trying to recreate particular SQL Server Database Versions for Testing. It allows you to automatically recompile any stored procedures or views saved with drop, create and permission statements. The scripts must all be sitting in one directory and end in the same extension. I have found this very […]
2002-02-25
690 reads
This stored procedure detaches and re-attaches a database without specifying a filename for the transaction log. This causes SQL Server to create log file with default size of 512kb.After playing around with SHRINKDATABASE, SHRINKFILE, forcing the virtual log to wrap around, etc... I found this was the quickest and most reliable method of reclaiming the […]
2002-02-25
2,612 reads
By Steve Jones
Don’t reserve your kindest praise for a person until their eulogy. Tell them while...
I wanted to try out the new JSON index which is for the moment...
By Brian Kelley
I thought it would be good to put my thoughts down on how to...
Comments posted to this topic are about the item Learning a New Language
Hi, we have a few people who like to experiment on our prod sql...
Comments posted to this topic are about the item Guidelines and Requirements
If I use DBCC CLONEDATABASE, can I remove some of the information from the copy?
See possible answers