Scripts

Technical Article

Get the Foreign Key Hierarchy 2

This procedure is just another approach for getting a list of tables defined in a database, ordered by dependency on other tables based on foreign key relationship.I used it for a deployment process, where the TABLE create scripts must be executed in the correct order,because the foreign key constraints are specified in the create script […]

4.5 (2)

You rated this post out of 5. Change rating

2003-04-18

371 reads

Technical Article

truncate logs regularly

It is a painful experience for all us administrators to truncate logs regularly. I just created a job to executesp_msforeachdb "use ?; backup log ? with truncate_only ; dbcc shrinkfile(2,5)"on all the servers at frequent intervals. It has saved me a lot of time. hope it helps you too.n.b: I assume that file id 2 […]

You rated this post out of 5. Change rating

2003-04-18

316 reads

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

821 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 (1)

You rated this post out of 5. Change rating

2003-04-17

949 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

140 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 […]

5 (2)

You rated this post out of 5. Change rating

2003-04-16

1,637 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.

5 (1)

You rated this post out of 5. Change rating

2003-04-14

1,868 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

748 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

Take Your Bets to the Next Level with TigerExch!

By davidjack

Looking for a reliable and exciting betting platform? TigerExch is your answer! With top-tier...

Score Big with TigerExch 247: Your Ultimate Betting Hub

By davidjack

Looking to up your betting game? TigerExch 247 has everything you need for top-notch...

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