T-SQL

Technical Article

Show all User-Defined Datatypes for all Databases

  • Script

This procedure displays all user-defined datatypes in all databases on a server.  Another example of the power of dynamic T-SQL, this procedure dynamically generates SELECT statements for the systypes tables in each database and UNIONs them together so that they display in one recordset.

You rated this post out of 5. Change rating

2003-05-30

157 reads

Technical Article

Table Pivoting revisited

  • Script

A lot of table pivoting scripts use cursors to reach the  desired results, but SQL scripting was developed to be utilized in a data set environment rather than sequential step-thru scripting.Normally, there are 3 types of Table Pivoting - 1) column explicit 2) column implicit and 3)single column.  COLUMN EXPLICIT will place the row value […]

You rated this post out of 5. Change rating

2003-05-29

418 reads

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: )

53,087 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

184 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

140 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,877 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

774 reads

Blogs

Getting References for GenAI Results

By

I wrote an editorial on the view of GenAI tech from execs and someone...

SQL Server 2025 Is Here – AI Just Changed Everything!

By

🔟 Top 10 Features of SQL Server 2025 #SQLServer2025 #MicrosoftSQL #DatabaseUpdates #SQLAI #SQLFeatures #SQLServerCopilot #VectorSearch...

SQL Blunders: Stop Writing These Pointless Queries & Write Smarter!

By

They run, they return data. So what? Some SQL queries just waste your time...

Read the latest Blogs

Forums

High Availability Reversed - Force secondary unless failure

By krypto69

Hi I have sql2022 in H/A with a primary and a secondary server. My...

telephones and sql

By stan

hi im pretty sure i could trigger a page on a pager if i...

T-SQL - except - add date column

By mtz676

SELECT         [A]       --,[Date]       ,  ...

Visit the forum

Question of the Day

Calculating Month End

I want to calculate the end of the previous month as a date that I can use in running a report. What is the best way to do this in SQL Server 2022, assuming I have a date stored in @d?

See possible answers