T-SQL – Search Stored Procedure Code for Text

Often I have to search for stored procedures in SQL Server to find pieces of text.   The motivation for this is to find procedures which use a table or to look for code which the developer has done silly things like hardcode directories (Boris….).  Luckly you can query sys.procedures to  generally find the information that you need.  Below is an example of query that searches for stored procedures for the word ‘c:\*’.

SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%c:\*%'

C# Methods with Unlimited Parameters

To create a method that can take unlimited parameters, utilize the params keyword in the method declaration.  This allows you to specify a method parameter that take an argument where the number of arguments is variable.   You are not allowed to … [Continue reading]

How to determine the version and edition of SQL Server

Connect to the instance of SQL Server, and then run the following query (this will work for all versions of SQL Server): Select @@version The result form the query will look like the following. Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 … [Continue reading]

How to get the column names of a table in SQL Server (T-SQL)

wlEmoticon-smile.png

The following query can be run (substitute the ‘TableName’ in the query with the table name you want column information on) to get the column names for any table in T-SQL. select column_name from information_schema.columns where table_name = … [Continue reading]

How to take a screenshot on a iPad.

Ipad.png

The iPad is a very easy to use device.  What is surprising is that sometimes things that you wouldn’t normally do everyday are possible but are hidden away. Thankfully taking a screenshot on the iPad is very easy to do.  All that is required … [Continue reading]

Enable xp_cmdshell using sp_configure

When you install a SQL Server instance, any feature that is not necessary for the core engine to run has been disabled by default. xp_cmdshell is a significant security risk because it allows a compromised SQL Server to elevate the attack to the … [Continue reading]

About Carlos Ferreira

Put Bio here. … [Continue reading]