Scripts

Technical Article

The case against using single-line comments

This isn't a "script" per se - but rather an observation about a common issue in writing scripts.I want to alert SQL programmers to the issues surrounding the use of single-line comments.  I try to avoid these whenever possible, and use block comments instead (except, of course, when commenting out the keyword GO).The reason is […]

3.67 (3)

You rated this post out of 5. Change rating

2003-01-21

272 reads

Technical Article

#sp_shrinkdata

Unlike shrinking transaction log, shrinking a data file seems to be tough. A lot of people complained about the "shrink database" option in EM not working, or DBCC SHRINKDATABASE not working, or DBCC SHRINKFILE not working. I have found that a data file will eventually shrink given enough try, time and patience. I've put everything […]

You rated this post out of 5. Change rating

2003-01-14

401 reads

Technical Article

SP to determine database file growth at intervals

I wrote this SP to be run from a job every night. Change the myDB reference to be a database on your system for DBA use.I just set up a job to run:Exec sp_CatchFileChangesThen I run in another step:Select * from mydb.dbo.tbl_sysaltfiles_3and output to a log file.Alternatively you could insert into another table with a […]

You rated this post out of 5. Change rating

2003-01-13

286 reads

Technical Article

Inherriting objects from an updated MODEL database

If new objects are created in the model database then these new objects only get created for new databases.Similarly, if objects are removed from user databases then getting them back into the database can be a pain.The following two stored procs copy objects from model to the current database if they do not already exist.

You rated this post out of 5. Change rating

2003-01-10

35 reads

Technical Article

Calculate Earth global distances

I wrote this sp to be able to calculate the distance between two locations on the earth if the latitude and longitude is known for each.  Could be useful for GPS work or maps.Usage:If I know the following city locations:Sydney         151.2 E             33.87 SCanberra       149.15 E             […]

5 (1)

You rated this post out of 5. Change rating

2003-01-09

774 reads

Technical Article

Check if batch is running.

WARNING:  This is resource intensive. Don't use except as a last resort.I wrote this to be able to find if a TSQL batch is running already on a SQL Server.  I use this rarely when I have to know to prevent running something twice.Usage:DECLARE @RC intDECLARE @SQLBatch nvarchar(255)-- Set parameter valuesEXEC @RC = [master].[dbo].[sp_RunningCheck] @SQLBatch […]

You rated this post out of 5. Change rating

2003-01-09

385 reads

Technical Article

Convert Degrees Minutes Seconds to Decimal UDF

I wrote this function to work with my sp_EarthDistance stored procedure.It converts the regular degrees/minutes/seconds representation of angles to a decimal number.Remember to use '' instead of ' within a string to be treated a character and not an end quote.Sydney location    151¦12'0 "E               33¦52'0 "S and in […]

4 (1)

You rated this post out of 5. Change rating

2003-01-09

802 reads

Technical Article

Search All Columns in All Tables for a string

This procedure can search all columns in one or all tables for a specified string. Prints out the TableName.ColumnName that the string is found in...--     Example Calls--     EXECUTE spFindTextInColumns MyTable, 'tcart' --search a specific table--         --     EXECUTE spFindTextInColumns default, 'tcart' --search all tables BUG FIX : (2003/01/20) Changed SELECT @columnName […]

3 (2)

You rated this post out of 5. Change rating

2003-01-09

906 reads

Blogs

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Microsoft Releases Windows 11 ARM ISO – A Game Changer for ARM-Powered Devices

By

Yesterday, Microsoft released the highly anticipated Windows 11 ARM ISO image, marking a major...

Read the latest Blogs

Forums

Table Delete

By Bruin

I have a very large table and I'm looking to do a cleanup based...

Creating paginated report where each page is a month in the range selected

By plsh

With in the paginated report I am trying to display on each new page...

Upgrading SSIS and SSRS from SQL Server 2016

By Deni Kusdeni

Hi All, I have plan to upgrade SSIS and SSRS from SQL Server 2016,...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers