Scripts

Technical Article

Detection of Broken Forign Key Relationship

Under special circumstances, it could happen that database contains "orphan" records. Data in dependant table exists without it's "parent" record in a master table. It could be caused by a bulk insert operation without CHECK_CONSTRAINTS option, or by disabling foreign key for a while or adding a foreign key to a table that already contains […]

5 (1)

You rated this post out of 5. Change rating

2002-03-27

193 reads

Technical Article

Script Generator for Triggers

This Stored Procedure creates the script of all existing triggersOptionally it creates the script to drop the triggers too.Triggers may belong to different owners. This procedure takes care of it.In SQLServer Enterprise Manager there is a facility to generate scripts forTables, Views, Stored Procedures etc.But it won't generate script for triggers unless we include the […]

5 (6)

You rated this post out of 5. Change rating

2002-03-27

2,652 reads

Technical Article

spAuditPasswords

This script is actually part of an article written about performing a simple password audit on SQL Server logins when you start to administor a new SQL Environment. The script will scan the sysxlogins table located in the master database for SQL Server logins with no passwords, passwords that are the same as the login […]

You rated this post out of 5. Change rating

2002-03-27

1,542 reads

Technical Article

Compare the structure & code of 2 databases

We often make changes in the test databases. But failure in making even the smallest change in the production database may lead to unwanted situations.This utility compares 2 databases.Parameters to be passed   @DB1  Database 1 (SysName)  @DB2  Databse 2 (SysName)  @ShowDifferentOnly see later (Bit)       Parameters 1, 2 may include server name as  well. […]

You rated this post out of 5. Change rating

2002-03-22

494 reads

Technical Article

Use DELETE On Many Tables With Foreign Keys

When deleting data from many tables, foreign key constraints can force you to specifically order your DELETE commands. This can take tons of time, especially if you have many tables.  Here's a technique I use to delete data in the correct order during the restaging of test databases.It makes use of the system stored procedure […]

You rated this post out of 5. Change rating

2002-03-22

1,591 reads

Blogs

Redgate Summit Comes to the Windy City

By

I love Chicago. I went to visit three times in 2023: a Redgate event,...

Non-Functional Requirements

By

I have found that non-functional requirements (NFRs) can be hard to define for a...

Techorama 2024 – Slides

By

You can find the slidedeck for my Techorama session “Microsoft Fabric for Dummies” on...

Read the latest Blogs

Forums

AG listener cant be removed

By ysalem

Testing with AG on Linux with Cluster=NONE. it was all going ok and as...

Remove comma inside Comma Delimited File csv in SSIS Using Script task

By hongho2

Hi, I have two tables: one for headers with 9 fields and another for...

Inserting 100K rows Performance - Baseline Performance

By MichaelT

We're trying to understand how quick new versions of SQL server can be.  Obviously...

Visit the forum

Question of the Day

The "ORDER BY" clause behavior

Let’s consider the following script that can be executed without any error on both SQL Sever and PostgreSQL. We define the table t1 in which we insert three records:

create table t1 (id int primary key, city varchar(50));

insert into t1 values (1, 'Rome'), (2, 'New York'), (3, NULL);
If we execute the following query, how will the records be sorted in both environments?
select city

from t1

order by city;

See possible answers