Scripts

Technical Article

Get Column Lists script

This is a script like Column_Gitter by Rick Bolin (RickInMesa), it differs in the fact that it does not use cursors, it optionally adds the table name, it handles UDDT (User Defined Data Types) properly, and handles the new SQL Server 2000 datatypes.Usage: Open this script in QA, Change QA to the desired Database, Edit […]

5 (1)

You rated this post out of 5. Change rating

2003-09-24

714 reads

Technical Article

Compare the structure of two tables.

@strUser_nm is the owner of the table.  If the modifyname table does exist, it will alter it with the same structure as the sourcename table.  If the modifyname table exists, it compares the columns and add any that are missing.  The procedure passes an output parameter.  This is used to know if we need to […]

You rated this post out of 5. Change rating

2003-09-22

476 reads

Technical Article

Rename Foreign Key Constraints

This script will rename all FK constraint names in your database.  It will give them a user friendly name that can be used in error messages, etc. The FK contraint names will be formatted as FK_ChildTableName_ParentTableName_soid. Note: You first need to enable 'Allow modifications to be made directly to the system catalogs'. This can be […]

You rated this post out of 5. Change rating

2003-09-19

1,162 reads

Technical Article

Know all Database sizes in a server.

We can know how much space a database is occupied in hard disk by using sp_spaceused function. If we want to find all database sizes at a time, we have to provide use  and sp_spaceused for all databases. It takes some time to write all those T-sql statments. My script will find each and every […]

3 (2)

You rated this post out of 5. Change rating

2003-09-16

1,657 reads

Technical Article

A faster way to count rows in a table

SQL Server includes the COUNT function for counting a table's rows - however, it can be slow.  Although querying the "rows" column from the sysindexes table is faster, it is not always accurate (e.g., if a bulk load process has recently taken place).  In addition, you would not be able to use this method in […]

1.33 (3)

You rated this post out of 5. Change rating

2003-09-11

401 reads

Technical Article

Get contents of a directory/share to a table

Following on from todays QOD (on xp_cmdshell permissions) I thought this might be useful.Takes a directory or UNC path and returns the contents as a table.  eg:exec sp_getdir '\\mypc\c$'returns:datestring timestring directory   filesize    nameoffile---------- ---------- ----------- ----------- ----------------------18/07/2003 10:45      1           NULL        Documents and Settings18/07/2003 11:02    […]

You rated this post out of 5. Change rating

2003-09-04

250 reads

Technical Article

To Get Latest SQL Job Status

This query will give you the current job status of all scheduled jobs on sql server. Just by using sysJobs, and sysJobHistory table you will get to know the details about the last status of the scheduled jobs, irrespective of their status like failed, successful, or cancelled.Note: You must have admin right on MSDB database […]

3.54 (13)

You rated this post out of 5. Change rating

2003-09-04

8,515 reads

Blogs

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...

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...

Read the latest Blogs

Forums

It's The People

By Grant Fritchey

Comments posted to this topic are about the item It's The People

To View or not to View, that is the question...

By pietlinden

I've read lots of the horror stories about nested views in databases where they're...

Grant user read-write permission to a single database

By PJ_SQL

Hello! How do I grant a user to read-write to a single database and...

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