Scripts

Technical Article

Copy all jobs, job steps and job schedules

This vbscript will generate the sql to recreate all the jobs running on a given SQL server. I wrote this because the last time we migrated a SQL server, I ended up re-creating all the jobs, steps and schedules by hand using the Enterprise Manager. It was the slowest, dullest and most error-prone part of […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2003-04-17

978 reads

Technical Article

Error Handling in SQL Server (like Visual Basic)

Using this technique you can do error handling in SQL Server using the same way you do in Visual Basic (most of it). Just put your SQL Statement in exec('SQL Command') and make use of @@Error to get error information and put your error handling code in If block.Mohit NayyarMCP (.Net), MCSD, MCDBA

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2003-04-17

989 reads

Technical Article

How to get Foreign keys

If you ever have been put in a situation where your database has a lot of objects and some of those do not have primary keys, trying to find feels like needle in the haystack.  I have modified the script contributed by Mr.Tandrei and Mr.Rahul sharma.  The following script gives all the tables that do […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2003-04-17

161 reads

Technical Article

To get Table and column name for Primary Keys.

This query will give you the table name and column name on which you have defined the primary key. You can use this to get columns on which the primary key is based. I find it very useful when i need to define the FK relationship for other tables in PowerDesigner. Try to do the […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(2)

You rated this post out of 5. Change rating

2003-04-16

1,756 reads

Technical Article

Copy Permissions for a database

Copies the permissions from an existing database user to a new database user.Usage:exec copy_permissions_for_database 'From_User', 'To_User'* From_User must exist in the database.* To_User must not exist in the database.* To_User must exist as a login on the server.I used http://www.sqlservercentral.com/columnists/awarren/sqlpermissionspublicrole_2.asp as a starting point.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2003-04-14

1,907 reads

Technical Article

Dynamically Generating HTML Tags from T-SQL

Here's a real-life challenge I was faced with at work: my company (a talent agency) needed me to create a report listing all of our actors that we represent - and for each actor, a comma-delimited string of each production that they've starred in.  Simple enough, right......except that, within the comma-delimited list of productions, they […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2003-04-11

808 reads

Blogs

Architecting Zero Downtime Deployments–Day of Data Boston

By

Here are the resources for my talk at Day of Data Boston. Slides –...

The Book of Redgate:A Prehistory

By

I’ve covered the values in a number of previous posts on the Book of...

Evidence-bound: what AgentDBA will and won’t link

By

When the evidence names the database, it says so. When it doesn’t, it stops....

Read the latest Blogs

Forums

SQL Server Storage Optimization: Multiple Files in a Filegroup vs Dedicated File

By abdalah.mehdoini

Hello, I would like to get some feedback regarding the best storage optimization strategy...

Azure SQL Database Event Log Limitations

By abdalah.mehdoini

Hi, Do you know if there is a way to get more detailed logging...

Four Rules for Adding AI Without Breaking What Already Works

By dbakevlar

Comments posted to this topic are about the item Four Rules for Adding AI...

Visit the forum

Question of the Day

Hyperscale Replicas III

In an Azure SQL Database Hyperscale Edition, how many named replicas can be configured?

See possible answers