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)

2002-10-21

1,070 reads

sp_CompareTblCnts

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.

2002-10-09

114 reads

sp_GetUserInfo

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.

2002-10-09

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 […]

2002-10-08

223 reads

sp_spaceused2

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 […]

2002-02-19

273 reads

Blogs

Getting the Proc Code–#SQLNewBlogger

By

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

Running SQL Server in Google Cloud Platform

By

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

More ADLS Gen2 enhancements

By

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

Read the latest Blogs

Forums

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

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers