May Thoughts

When I started this blog, I had two objectives in mind. The first was to have a technology journal to keep track of things I didn’t want to forget. The second was to have my name come up in any Google searches a potential employer, client or partner might make and to provide some information about me and what I do. These were both professional objectives and I’ve long been aware that the site is good mostly for the yawning it inspires. [Read more...]

Get SQL Command Executing by SPID

I’m sure there are other ways to do this but this is pretty easy:

DECLARE
 @SPID INT,
 @Handle binary(20),
 @retVal varchar(8000)

SET
 @SPID = 148

SELECT
 @Handle=sql_handle
FROM
 master..sysprocesses
WHERE spid = @SPID

SELECT
 SqlCommand=convert(varchar(8000), [text])
FROM
 ::fn_get_sql(@Handle)

References

Stored Procedure Naming Convention

Never use the sp_ prefix for a user-stored procedure. One reason is that it can make it hard to tell which sprocs are delivered and which are user-defined. Another is that if you prefix your sprocs with sp_, SQL searches for the prefix in the master db each time the procedure is called, before looking in the local database. Use usp_ instead.

From Microsoft eLearning Course 3595: Establishing Database Conventions and Standards for Microsoft® SQL Server™ 2005.

Partitioning and Formatting Disks for SQL Server Performance

When you add new disks to a server and you intend to use them for SQL Server log and data files, there are some suggested best practices in preparing the disks. I suggest you read this post, then read the resources below before taking any action. Some of the configuration values in the Partitioning and Formatting steps below are not universally agreed upon despite strong evidence to support their validity. It is important that you understand the nature of your environment and come to your own conclusions regarding configuration before you proceed. [Read more...]