E-Mail:

SQL Server 2005

Optimizing Transaction Logs

Welcome back and Happy Saturday!
Today I wanted to share with you that some DBAs seem to overlook the transaction log when thinking about optimizing database performance.  I myself was guilty of not considering optimizing the transaction logs for my production databases.  I am going to blog about Virtual Log Files (VLFs) and why it is important [...]

Fixing Orphaned Users In SQL Server 2005

The other day i restored a QA database in compatibility level 90 (SQL Server 2005) to a production server that had SQL Server 2005 installed.  The restore went as expected however, the logins that were already there on the SQL Server had different SIDs than the users in the database that was restored.  We maintain three [...]

Inserting DBCC CHECKDB Results Into A Table

Hello again and welcome back!
I thought today’s posting to my blog should cover how to get the results of DBCC CHECKDB into a table.  Unfortunately, Microsoft does not allow you easily per se to insert the results into a table so that you might be able to generate administrative reports off of.  Well in my [...]

Using Double Quoted Identifiers In Linked Servers

The other day I was trying to obtain connection information from master.dbo.sysprocesses via a linked server call using SQL Server 2005. So the statement I was running looked like this:

INSERT INTO connection
SELECT DISTINCT [name],
hostname,
program_name,
loginame,
nt_username,
net_address,
last_batch, 
getdate()
FROM OPENQUERY(”SQL1\V01″, ‘SELECT d.[name], p.hostname, p.program_name, p.loginame, p.nt_username, p.net_address, p.last_batch, getdate() FROM master.dbo.sysprocesses as p inner join master.dbo.sysdatabases as d on p.dbid = d.dbid‘)

When I execute the insert\select statement it works in [...]

Bug with db_name?

The other day I was pulling data from the sysprocesses table on a remote SQL Server 2000 server. I was on a database server that has SQL Server 2005 Service Pack 2 on it and I have the destination (remote) SQL Server 2000 setup as a linked server on the SQL Server 2005 server. With [...]

Better Ways To Monitor SQL Server 2005!

The other day I found myself looking at new\different ways to monitor the health of my production SQL Server 2005 servers. I thought that there must be a better way to monitor in SQL Server 2005 than in SQL Server 2000. So as I was looking through books online and perusing the internet [...]

How To Calculate If Hour Is Even Or Odd In T-SQL..

Hello there…
Today is going to be a short posting on how to calculate whether or not the hour in either the function getdate() or a datetime field in a table is either even or odd. I am using this to determine which tables (evenhour or oddhour) are recording page impressions. Here is the T-SQL script:  select datepart(hour,getdate())%2 [...]

How To Turn Imported XML Into A Relational Format in SQL Server 2005..

Welcome back!
I hope you found my how to import XML into SQL Server 2005 helpful. Today I thought we would take a step further and turn that imported XML file into a relational format\table. In my previous post you created a table via T-SQL taht contais a field called xml_data with a data [...]

How To Import A XML File Into SQL Server 2005…

Hello again…
Today I wanted to share how to import a XML file into SQL Server 2005. There are different ways to import a XML file either through T-SQL, SSIS, VB Script, etc. I have found the easiest method for just getting and XML file into SQL Server 2005 is to use T-SQL.
I found [...]

Now Rebuild Indexes Online In SQL Server 2005!

Today I was looking for a “better way” to rebuild indexes in SQL Server 2005 and to minimize blocking\contention in the database. As I was looking through BOL I came across the ALTER INDEX statement. If you want to rebuild all indexes on a specified table you can run the following code:
ALTER INDEX [...]

23 queries / 0.242 seconds.