T-SQL

SQLServerCentral Article

Nesting Stored Procedures

  • Article

We're pleased to announce that Robert will be writing for us each month - generally on stored procedures, but occasionally on a different topic. This article discusses how nesting stored procedures works and how to use @@NextLevel. Good reading! If there is a stored procedure topic you'd like to see covered, add a comment to the article or email us at articles@sqlservercentral.com

3.5 (2)

You rated this post out of 5. Change rating

2007-10-02 (first published: )

51,478 reads

Technical Article

How to retrieve roles from a Database

  • Script

If you have environment where you restrict access to database objects based on user roles and if you have a lot of databases on different servers in the same domain.  The following script can generate roles from a given database in a format that can be used to create roles on different servers where the […]

You rated this post out of 5. Change rating

2003-05-14

178 reads

Technical Article

How to get Foreign keys

  • Script

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

139 reads

Technical Article

Copy Permissions for a database

  • Script

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,844 reads

Technical Article

Dynamically Generating HTML Tags from T-SQL

  • Script

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

703 reads

Technical Article

Date Only

  • Script

This is a follow-on to info's script to strip the time portion of a datetime or smalldatetime, leaving only the date.  I found info's script interesting!  When I had to do this I converted the date to varchar and back again instead of to float.  Seems to work fine for me.

You rated this post out of 5. Change rating

2003-04-03

115 reads

SQLServerCentral Article

Gathering Random Data

  • Article

Brian Knight recently had the basic need to retrieve a record from the database at random. What seemed to be an easy task quickly became a complex one. This case showed an interesting quirk with T-SQL that was resolved in an equally quirky way. This quick article shows you a method to retrieve random data or randomize the display of data.

5 (1)

You rated this post out of 5. Change rating

2003-03-26

9,319 reads

Technical Article

Weekly Reports Made Easy

  • Script

Each week you are required to run various reports based on table entries made during the week preceding latest Sunday. Use this SQL7/2000 procedure (can be a UDF in SQL2K) to retrieve the latest midnight of a specified day of the week as illustrated below: Declare @StartDate datetime, @EndDate datetime Exec DBAservice.dbo.uspGetLatestWkDayMidnight @pDate = '1998-05-06', […]

You rated this post out of 5. Change rating

2003-03-13

305 reads

Blogs

Bicep Your Elastic Jobs

By

I posted on Terraform and Azure SQL last year but wanted to see what...

3rd Party Applications Have Issues

By

As a SQL DBA, what do you do when a vendor application has performance...

Check Azure SQL DB Space Used

By

A couple of days ago I was doing some cleaning on some Azure SQL...

Read the latest Blogs

Forums

The On-Call Load

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The On-Call Load

Two Table Hints

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Two Table Hints

Database Dashboards in Azure Data Studio

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Database Dashboards in Azure Data...

Visit the forum

Question of the Day

Two Table Hints

What happens when I run this code:

SELECT
  p.ProductName
, p.ProductCategory
FROM dbo.Product AS p WITH (NOLOCK, TABLOCK);

See possible answers