Database, SQL, SQL Server 2005, SQL Server 2008, SQL Tips, System Objects, Transact-SQL, tSQL

Get All Linked Servers Modify Date in SQL Server

Microsof SQL Server
Microsof SQL Server

This is a short post that extends on a concept that I talked about in a previous article about querying linked server information in SQL Servers 2005, 2008, & 2012 using T-SQL. Specifically, I will give an example of how to check the last modified date for each linked server residing on your database server. Continue reading “Get All Linked Servers Modify Date in SQL Server”

Advertisement
Database, Programming, SQL, SQL Server 2005, SQL Server 2008, SQL Tips, System Objects, Transact-SQL, tSQL

T-SQL Programmatically Script Modified Stored Procedures

T-SQL
T-SQL

In this example I will show how to write a T-SQL routine that scripts any stored procedures in your database that have been modified in the past three days. You should, of course, modify this time filter as you see fit.

This T-SQL routine is useful to extend the scripting option built into SQL Server Management Studio, and can be even more useful if you are considering using it programmatically. Continue reading “T-SQL Programmatically Script Modified Stored Procedures”

Programming, SQL, SQL Server 2005, SQL Server 2008, SQL Tips, System Objects, Transact-SQL, tSQL

T-SQL – Find Where Table Data is Stored

T-SQL Example
T-SQL Example

In this article  I will expand on an article I wrote earlier about how to search through all of the columns in each table in your database for a particular piece of information.

In the example in this article I have:

  1. Modified my previous example query to search through columns of all datatypes rather than just VARCHAR type columns. This is important since often tables will have columns consisting of custom datatypes or possibly even Int value columns depending on your search.
  2. I’ve changed what is output to be the distinct table name and column names that contain the information you are looking for. You’ll be able to take useful looking results from this overview information and then run detailed queries to find out more.
  3. Also, I have modified the original query to do an exact match for the data being searched for rather than a LIKE condition. If you would like to change this back to a LIKE condition, then I have highlighted the relevant section in red that you can replace with the LIKE condition example in my previous article.This exact match is useful in particular if you are looking for an identity key value throughout your database such as: show me the user Jim who has an ID of 56 so that I can track down all instances of his account information in our database.

Continue reading “T-SQL – Find Where Table Data is Stored”