Scripts

Technical Article

Change Result Set Columns to Rows

I had a developer in my company come to me recently with a unique request.  He asked if there was any way for sql to return a result set that was flopped.  In other words he wanted the rows to be columns and the columns to be rows.  So that a result set like this:Col1    […]

You rated this post out of 5. Change rating

2004-07-19 (first published: )

344 reads

Technical Article

Report to return all foreign key information

The purpose of this task is to generate a report showing all your foreign keys. Generally this would be considered  nothing special only that this script also returns the tables, column foreign key constraint name and the relationship properties.Here's how to do it:First of all copy the script and paste it in Query AnalyzerStep 1: […]

5 (1)

You rated this post out of 5. Change rating

2004-07-16 (first published: )

1,004 reads

Technical Article

Advanced Search Stored Procedure

The script finds occurrences of string(s) in stored procedures, triggers and views. You can use typical boolean logic as described in the script comments. Very useful.  It was found on the companion cd to [Gurus Guide to Transact-SQL] by Henderson.  I left in the original credits.  Excellent procedure.  Some may scoff but I place it […]

You rated this post out of 5. Change rating

2004-07-15 (first published: )

655 reads

Technical Article

Format numeric values to language specific format

SQL Server returns numeric values always in a internal format. The conversion of numeric values into a language specific format is usually part of the client. With this User Defined Function, you can do thison your backend. The function expects 3 parameters: The numeric value, the requested language and the number of decimals (will be […]

You rated this post out of 5. Change rating

2004-07-13 (first published: )

302 reads

Technical Article

List User Permissions

Do you ever need to look for a given user's permissions for security reasons or move the permissions for that user from test environment to production? This is a script, which will generate print statements, which can be use to view/grant, the permissions of all dbo objects, which the given user has, which is not […]

2 (1)

You rated this post out of 5. Change rating

2004-07-08 (first published: )

871 reads

Technical Article

Generate Random Alphanumeric Strings

This script will generate and populate a table variable with a stipulated number of unique 8 randomly generated character alphanumeric values. This can be useful in situations where one has to allocate passwords or unique id to users. It accepts one input parameter "@HowMany int" representing the number of these alphanumeric values to generate; default=500.Usage: […]

You rated this post out of 5. Change rating

2004-07-06 (first published: )

3,252 reads

Technical Article

Restore Backup and all TRANLOGS in a specific DIR

Many DBA's have a Maintenance plan running that creates a backup every night and a transaction log backup every hour.Restoring them to another server (for whatever reason) can be a tedious job. That is why I wrote this T-SQL script.It will read the contents of a backup directory created by the maintenance plan and create […]

5 (1)

You rated this post out of 5. Change rating

2004-06-25

906 reads

Technical Article

Find Instances of a Column Name

This script will allow you to find all instances of a column name, or partial column name, in all user tables in the database in which it is run.  This is sometimes helpful during upgrades, etc.  There is no error checking in this script.  You can modify it to add, if needed.Run this by simply […]

5 (1)

You rated this post out of 5. Change rating

2004-06-21

168 reads

Blogs

Spark Connect Dotnet November 2024 Where are we?

By

All Spark Connect Posts Introduction There have been quite a few changes in the last...

A New Word: Ochisia

By

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

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Read the latest Blogs

Forums

Writer methods in PowerQuery (LOL)

By pietlinden

I'm using PowerQuery in Excel on my desktop. (Yeah, I know you can do...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

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