Showing posts with label piece. Show all posts
Showing posts with label piece. Show all posts

Sunday, March 11, 2012

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Deadlock alert (message ID 1205) no longer able to be logged in 2005

Hi all,

In SQL Server 2000 you could run the piece of code below, to enable the logging of a deadlock in the SQL Server error log. Which could then be used to fire an alert, and then kick of an Agent job to send an SMTP email alert.

Exec sp_altermessage 1205, 'WITH_LOG', 'true'

The error message logged was a nice simple one liner, like this:

Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

Now I work for a managed SQL Server company, and a large number of our clients used our alerting for deadlocking to tune their applications, or at a minimum to show them when something was wrong with the database due to sudden rise in the number of deadlocks.

However, in SQL Server 2005, the functionality for the sp_alertmessage procedure has been changed so that you can't update any message id less than 50,000. Which comes inline with the secure engine that Microsoft have designed.

But this now means you can no longer enable the logging for deadlock message ID 1205. Which in turn means no alerting can be enabled.

You can still log information by enabling the necessary trace flags, however that logs very verbose information about the deadlocking chain, which in turn can quickly blow the size of the error logs out.

What I would love to see is this functionality returned in SQL Server 2008, or at least an alternative so that only minimum information is logged initially for a deadlock, and alerting can be setup.

Also, for those of you who have read through the 2005 BOL, about deadlocking, although it states the following in the section on deadlocking:

"...The 1205 deadlock victim error records information about the threads and resources involved in a deadlock in the error log.”

This isn't the case, unless you enable some trace flags, which as mentioned will give you a whole lot of information, which although is valuable, isn't ideal if you're wanting day to day deadlock tracking.

Does anyone have any thoughts on this? Have you struck this as well? Do you think this should be something that shouldn't have been removed from 2000?

Cheers,

Reece.

Does anyone have any info or opinions on this?

Cheers,

Reece.

|||

We experienced the same frustration for deadlocks, primary key violations, login failures and permission denied. These alerts are needed on several of our SQL 2000 servers, but can no longer be implemented on SQL 2005. We find this very frustrating and do not understand the logic behind the decision to remove this functionality.

Dave

|||

completely agree with you and I can't understand why this is so. I did try via the dedicated admin connection but still couldn't appear to get around this. I used to set alerts on various errors in sql 2000 for all types of errors as part of debugging production software releases and such. Not needed to do this for last couple of years but now want to do this with sql 2005 and I can't. What a pain!

|||I beleive you can use DBcc traceon to capture the details of deadlock victims details .

DBCC TRACEON

Trace flag 1204

This trace flag returns the type of locks participating in a deadlock and the current command affected.

Trace flag 1205

This trace flag returns more detailed information about the command being executed at the time of a deadlock.

|||

Yes I know about and use the trace flags - but what I really wanted was an alert on the deadlock so I could grab a snapshot of all actiivty, and know when the deadlock occurred without trawling the error log.

|||

I'm glad I'm not the only one experiencing this frustrating change in functionality.

I have also listed this on the BETA site for 2008, as something that should be added back into the engine. But as yet I haven't had any feedback from Microsoft on whether it's going to make it on the to-do list or not.

We've also tried the trace flags, but I agree with colin, all we want is an alert that a deadlock has occurred, without the verbose logging that the trace flags bring with them.

Cheers.

Thursday, March 8, 2012

deadfully slow cursor?

I've got the following piece of code in a stored procedure, and despite the tables only having about 25K records, its dreadfully slow.

DECLARE Perfer CURSOR FOR
SELECT PerformerID
FROM PAMRA_tbl_navnmatch (NOLOCK)

DECLARE @.test as int

OPEN Perfer

FETCH NEXT FROM Perfer
WHILE @.@.FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM Perfer into @.test
UPDATE PAMRA_tbl_navnmatch
SET PAMRA_tbl_navnmatch.Sgenavn = convert(char(50),NAMEMATCH_vw_memberdata.Sgenavn) ,
PAMRA_tbl_navnmatch.Medlemsnavn = convert(char(50),NAMEMATCH_vw_memberdata.Medlemsna vn),
PAMRA_tbl_navnmatch.Medlemsnavn2 = convert(char(50),NAMEMATCH_vw_memberdata.[Medlemsnavn 2]),
PAMRA_tbl_navnmatch.Medlemsnummer = convert(int, NAMEMATCH_vw_memberdata.Medlemsnummer),
PAMRA_tbl_navnmatch.Nationalitet = convert(char(10), NAMEMATCH_vw_memberdata.Nationalitet),
PAMRA_tbl_navnmatch.Organisationsnummer = convert(char(10),NAMEMATCH_vw_memberdata.Organisat ionsnummer),
PAMRA_tbl_navnmatch.Medlemskab = convert(char(20), NAMEMATCH_vw_memberdata.Medlemsskab),
PAMRA_tbl_navnmatch.IPDnummer = convert(int, NAMEMATCH_vw_memberdata.[IPD Nummer]),
PAMRA_tbl_navnmatch.IPDroll = convert(char(20), NAMEMATCH_vw_memberdata.IPDrolle),
PAMRA_tbl_navnmatch.Franavision = 1
FROM PAMRA_tbl_navnmatch INNER JOIN NAMEMATCH_vw_memberdata ON ltrim(rtrim(PAMRA_tbl_navnmatch.Matchfelt)) = ltrim(rtrim(NAMEMATCH_vw_memberdata.[Sgenavn]))
WHERE PAMRA_tbl_navnmatch.PerformerID = @.test
END

CLOSE Perfer
DEALLOCATE Perfer
GO

Is there any way to speed things up? I mean, its been running for more than 45 minutes now. I can track the progress, and it does move forward, BUT yawn its slow.

Its even run on a dual xeon 3.2 server with 4 gigs of memory, only other acticity is a few simple selects on other databases. No locks or anything.

Whats amiss? or is the comparison between char fields just dreadded?HUH?

First, your FETCH Statement doesn't have an into.

Second you don't need the cursor

Third you're already refereincing the table in the update that's in the cursor.

Forth, you're going to update all rows anyway...

Is someone playing a trick on you?|||index on NAMEMATCH_vw_memberdata?

why are you using a cursor for this ? it looks as if you should be able to use an insert...

-Kilka|||why are you using a cursor for this ? it looks as if you should be able to use an insert...

-Kilka

Huh?

This should do the same thing.

UPDATE n
SET Sgenavn = convert(char(50),NAMEMATCH_vw_memberdata.Sgenavn)
, Medlemsnavn = convert(char(50),NAMEMATCH_vw_memberdata.Medlemsna vn)
, Medlemsnavn2 = convert(char(50),NAMEMATCH_vw_memberdata.[Medlemsnavn 2])
, Medlemsnummer = convert(int, NAMEMATCH_vw_memberdata.Medlemsnummer)
, Nationalitet = convert(char(10), NAMEMATCH_vw_memberdata.Nationalitet)
, Organisationsnummer = convert(char(10),NAMEMATCH_vw_memberdata.Organisat ionsnummer)
, Medlemskab = convert(char(20), NAMEMATCH_vw_memberdata.Medlemsskab)
, IPDnummer = convert(int, NAMEMATCH_vw_memberdata.[IPD Nummer])
, IPDroll = convert(char(20), NAMEMATCH_vw_memberdata.IPDrolle)
, Franavision = 1
FROM PAMRA_tbl_navnmatch n
INNER JOIN NAMEMATCH_vw_memberdata m
ON ltrim(rtrim(n.Matchfelt)) = ltrim(rtrim(m.[Sgenavn]))|||yup :)

do you have better luck that way ?|||the only reason why I do it using a cursor is because the full update simply dies... it takes yonks time...

my first guess was "somethings terribly wrong"... which is true... but since I can't change that the server is slow, I figured doing it cursor-wise, record by record, the update would take time, but in the end complete anyway.

So, yes, something is playing with, the fact that the database is - apparently - mindnumbingly slow for God knows what reason..

/Trin

P.S. I let the clean update run for 3+ hours, then I just gave up... the cursor version takes little under an hour to do.. so although not exactly Einstein, it gets the job done. I was just hoping there was any other way to boost it.|||Apparently the problem is solved.

Somewhere in the scripting of creating tables, I hadn't included indexes... so, at new creation, no indexes were made..

After I added indexes I was able to the basic UPDATE without cursor fairly quickly...

sigh..|||Let's be very clear here.

A Set Update will always out-perform a cursor based solution.

If you are having performance problems, you should trouble shoot that...not through a cursor at it...

And I'm just curious...what's with all the TRIM and CONVERT usage?

Post the DDL of thos 2 tables please.|||Troubleshooting isn't always an option when you have a deadline... the cursor got the job done on time, and now I can troubleshoot while performing the same operations on a different set of data.

The reason for the trims is that much of the populated data is inserted into the tables by various dubious access forms and excel sheets. Spaces in front of and behind stuff... so I merely do it to ensure blanks are killed off until I get to the point of trimming at the front-end.

DDL?