Scripts

Granting Access Permissions...

Usually when we recreate or rename a table we need to give the appropriate access permissions to the SQL users...this is very common in database under development environment where frequently table structure changes and we have to recreate it....we can accomplish this with Enterprise Manager but what will you do if Enterprise Manager fails to […]

2001-12-18

803 reads

List Table Definition

System Stored Procedure to List the Table Definition of a table as a printable report. The procedure must exist in the master database. This works for any table in the current database. Do not fully qualify the tablename. Calling sample: use pubs exec sp_listtabledef 'authors'

3 (3)

2001-12-18

3,360 reads

OSQL Process Watcher

These 2 files plus sleep.exe (Resource kit) gives an administrator a good view of important blocking statistics in almost a real time fashion. You can use this with profiler to obtain some unique information very fast on a lead blocker if your gathering the right counters in profiler and dumping them in a table and […]

2001-12-10

487 reads

Pass an Array into a Stored Procedure

Have you ever wished T-SQL allowed you to pass an array into a stored procedure? Well the spListToTable stored procedure listed below accepts a delimeted string and turns it into a table. Code your stored procedure to accept a varchar, create a temporary table, call spListToTable, and use the populated temporary table as if it […]

4.25 (4)

2001-12-10

2,827 reads

Fix - Orphaned User Connections

Run the '1'-first script.This stored procedures will easily script all the logins and passwords, which will then help you to transfer them to another SQL Server. Run the '2' - Second Script. This will fix the Orphane Connections. Run the '3' - Third Script. Fixing some Orphaned Users left after step 2. NOTE: Script below […]

3 (1)

2001-12-09

2,109 reads

How to Short-circuit Where Clauses

There are many times when you might be concatenating text in a stored procedure to make a where clause, because the input parameters are optional. An alternative is to create many versions of the stored procedure - one for each possible combination of parameters - which can soon become too big. There is a more […]

3.75 (4)

2001-11-25

4,246 reads

Blogs

Daily Coping 10 Jul 2020

By

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

Daily Coping 9 Jul 2020

By

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

Refreshing a Power BI Dataset in Azure Data Factory

By

I recently needed to ensure that a Power BI imported dataset would be refreshed...

Read the latest Blogs

Forums

temp table performance in sql 2016

By rohitkocharda

HI everyone, I just restored a DB on sql2016 from sql2012. One of my...

Nearest Proximity For every record

By marty.seed

Hello! We have a query we are trying to build with a key component....

Isnull in a Where Clause

By luismarinaray

Dear friends, We used Stored Procedure on our Queries for us to get  valuee...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers