SlideShare a Scribd company logo
DECLARE @SQL NVARCHAR(max) SET @SQL = stuff(( SELECT ' UNION SELECT ' +
quotename(NAME, '''') + ' as Db_Name, Name collate SQL_Latin1_General_CP1_CI_AS
as Table_Name FROM ' + quotename(NAME) + '.sys.tables WHERE NAME LIKE ''%'' +
@TableName + ''%''' FROM sys.databases ORDER BY NAME FOR XML PATH('')
,type ).value('.', 'nvarchar(max)'), 1, 8, '') --PRINT @SQL; EXECUTE
sp_executeSQL @SQL ,N'@TableName varchar(30)' ,@TableName = 'Employee'

More Related Content

PDF
Linguagem sql
PPTX
MS SQL Database basic
PDF
The Ring programming language version 1.5.2 book - Part 22 of 181
PDF
The Ring programming language version 1.3 book - Part 14 of 88
ODP
PDF
Syntactic sugar in Postgre SQL
Linguagem sql
MS SQL Database basic
The Ring programming language version 1.5.2 book - Part 22 of 181
The Ring programming language version 1.3 book - Part 14 of 88
Syntactic sugar in Postgre SQL

What's hot (20)

PPTX
PDF
The Ring programming language version 1.10 book - Part 30 of 212
PPTX
Syntactic sugar in postgre sql
ODP
Prabu's sql quries
ODP
My sql Syntax
PDF
The Ring programming language version 1.7 book - Part 25 of 196
ODP
Mysql1
PPTX
Oracle: PLSQL Commands
PDF
Pemrograman SQL - CRUD Query
PDF
Stata cheatsheet transformation
PDF
Stata cheat sheet: data transformation
PDF
Tuples All the Way Down
PDF
Stata Programming Cheat Sheet
PPTX
Si0302 20140320131934
PPTX
Sql
PPTX
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
PDF
Stata cheat sheet: data processing
DOCX
library(sparkline)
PDF
2013 28-03-dak-why-fp
PPTX
DPLYR package in R
The Ring programming language version 1.10 book - Part 30 of 212
Syntactic sugar in postgre sql
Prabu's sql quries
My sql Syntax
The Ring programming language version 1.7 book - Part 25 of 196
Mysql1
Oracle: PLSQL Commands
Pemrograman SQL - CRUD Query
Stata cheatsheet transformation
Stata cheat sheet: data transformation
Tuples All the Way Down
Stata Programming Cheat Sheet
Si0302 20140320131934
Sql
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Stata cheat sheet: data processing
library(sparkline)
2013 28-03-dak-why-fp
DPLYR package in R
Ad

Viewers also liked (7)

PDF
Examen Bachillerato Matemáticas 0-2013
PDF
Examen mate 01 2014 unificado
PDF
Examen de matematica costa rica mep
PDF
Examen mate 00 2014 diversificada
PDF
Examen 2014 abril, Matemática - Bachillerato por Madurez
PDF
Examen de matemática bachillerato diurno 2014 último
PDF
Examen matemática abril 2013
Examen Bachillerato Matemáticas 0-2013
Examen mate 01 2014 unificado
Examen de matematica costa rica mep
Examen mate 00 2014 diversificada
Examen 2014 abril, Matemática - Bachillerato por Madurez
Examen de matemática bachillerato diurno 2014 último
Examen matemática abril 2013
Ad

Recently uploaded (20)

PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Cost to Outsource Software Development in 2025
PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Transform Your Business with a Software ERP System
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Digital Strategies for Manufacturing Companies
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
assetexplorer- product-overview - presentation
PDF
Understanding Forklifts - TECH EHS Solution
PDF
top salesforce developer skills in 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Design an Analysis of Algorithms I-SECS-1021-03
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms II-SECS-1021-03
Cost to Outsource Software Development in 2025
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Odoo Companies in India – Driving Business Transformation.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Transform Your Business with a Software ERP System
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Digital Strategies for Manufacturing Companies
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Upgrade and Innovation Strategies for SAP ERP Customers
Why Generative AI is the Future of Content, Code & Creativity?
PTS Company Brochure 2025 (1).pdf.......
assetexplorer- product-overview - presentation
Understanding Forklifts - TECH EHS Solution
top salesforce developer skills in 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Sqlcusesprac

  • 1. DECLARE @SQL NVARCHAR(max) SET @SQL = stuff(( SELECT ' UNION SELECT ' + quotename(NAME, '''') + ' as Db_Name, Name collate SQL_Latin1_General_CP1_CI_AS as Table_Name FROM ' + quotename(NAME) + '.sys.tables WHERE NAME LIKE ''%'' + @TableName + ''%''' FROM sys.databases ORDER BY NAME FOR XML PATH('') ,type ).value('.', 'nvarchar(max)'), 1, 8, '') --PRINT @SQL; EXECUTE sp_executeSQL @SQL ,N'@TableName varchar(30)' ,@TableName = 'Employee'