T-SQL

To find the next available ID

  • Script

There are times when you have a limited range of ids and these have to be re-used as they become available.The script lists the first missing id in a table.Note that this script works best for a table with a limited number of rows, say sub 100,000I tested this on a PIII 500MHz 256Mb RAM […]

2002-12-09

110 reads

Dynamic String Compare (W/O the dynamic sql)

  • Script

Purpose: To compare two strings with a supplied operator and return true if the strings evaluate to true using the operator provided. This is useful for stored procs to use instead of dynamic sql. YAY!  Allowing for the operator and value to be passed in as parms. So that the user on the front end […]

2002-12-07

460 reads

Stored Proc with optional parameters

  • Script

Sometimes people want a Stored Proc with optional parameters. A lot of times people will use a coalesce for this. The problem with optional paremeters is that the query plan will never be an exact mach for that specific query. ( You never know what paremeters are filled..... )To solve this problem look at the […]

2002-12-06

419 reads

Converting Binary data to a Hex Character String

  • Script

Occassionally you might want to convert a binary number into some printable string.   This would allow you display some meaning fully numbers hex characters, instead of just some unreadable garbage.  This script takes a binary field, of basically any length, and converts it, character by character, to a character string.  The character string will contain […]

2002-11-07

443 reads

sp_DBCompare

  • Script

This simple script make a comparison between two given database. It compare: The table present in both database            The data type, lenght, nullability, precision for each table.            The object present in both database. The StoredProc is able to compare database across different server, simple make […]

2002-10-31

768 reads

Latest DTS Package Log

  • Script

This script returns the latest package log for the DTS package specified in the @package_name variable.  The interface for viewing DTS package logs through Enterprise Manager is limited in the fact that it doesn't provide textual descriptions of the values for the Step Execute Status and Step Execute Results.  This makes it difficult to trace […]

2002-10-22

609 reads

Get Number of Days in month

  • Script

Have seen existing scripts to work out number of days in month. They tend to work out the month, and then whether it's a leap year.Another approach is to take the date passed in, find the first day of the next month, and then use Datadd to take off one day, ie: last day of […]

4 (1)

2002-10-17

393 reads

Create And Execute Table Script (SQL Server 2000)

  • Script

This SP will only work on SQL Server 2000 and can be placed in your master database. sp_CreateAndExecTableScript is designed to script one table and create an identical table. I designed it to use with DTS packages so that I can create an identical table with a different name, pump data into the table and […]

5 (3)

2002-10-15

1,514 reads

Blogs

Spark .NET - Spark ML TF-IDF

By

Spark ML in .NET for Apache Spark Spark is awesome, .NET is awesome, machine...

Daily Coping 7 Jul 2020

By

I’ve started to add a daily coping tip to the SQLServerCentral newsletter and to...

Publish ADF from code to further environments

By

Struggling with #ADF deployment? adf_publish branch doesn’t suit your purposes? Don’t have skills with PowerShell? I have good...

Read the latest Blogs

Forums

Document recovery procedure

By Admingod

Trying to document a process in an event of disaster and different reasons. In...

Get a list of RDL that have been deployed?

By jbalbo

Hi   Trying to clean up a VS RS project. Is there a way...

JSON - What am I doing wrong

By NicHopper

Hi, So I'm having a little play with JSON as I need to store...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers