Clinton Herring

Format a DOS date as yyyymmdd

Do you run jobs that call BAT files where you wish you could include a formatted date stamp in the output name of an OSQL file? Well, you can using the DOS 'FOR' command. I named a variable FILEDATE and use it as: path\Filename_%FILEDATE%.txt (Note: A BAT file requires double %% in the 'FOR' command […]

4.5 (2)


1,070 reads


This stored procedure does a quick table comparison between 2 databases that are supposed to be the same. Tables found on either db but missing from the other are reported as are record count differences for matching tables. Establish a linked-server with appropriate permissions to compare across servers. Compile in master.


114 reads


Returns database user information as a runnable script for the specified database. The default is master. Great for restoring user access and permissions after a restore to a development server. Run prior to the restore and save the output to an sql file.


1,016 reads

Find and replace column constraints

I submit this script as an example of how one might go about generating 'Alter Table' statements that find and replace specific column constraints. In my case I had to find all occurrences in a production db of suser_name() as a column constraint and replace it with suser_sname(). This script is only an example and […]


223 reads


An update to sp_spaceused2. This update fixes some problems related to dbs that are non-accessible such being offline. This stored proc can be run from any database when compiled in master and can report information on all databases at once. Get information on all dbs, one db, one db and all its tables or one […]


273 reads


Getting the Proc Code–#SQLNewBlogger


Another post for me that is simple and hopefully serves as an example for...

Running SQL Server in Google Cloud Platform


On a few occasions I’ve referred to GCP (Google Cloud Platform) as the “Windows...

More ADLS Gen2 enhancements


On the heels of More Azure Blob Storage enhancements come more enhancements for Azure...

Read the latest Blogs


Options to create readonly near realtime copy of a database

By ricardo_chicas

Hello all, I have a 2 node cluster, with a database that is part...

Limitation on a file size import

By cbrammer1219

Is there a restriction of file size that can be imported into SQL? 5...

How to change the Scan to Seek and optimize

By sizal0234

Hello, Attached sample query and actual plan, I want to further optimize the query...

Visit the forum


SQL Server Q&A from the SQLServerCentral community

Get answers