Removing LTRIM and RTRIM from SQL Stored procedures

Posted by Manzoor_mustafa under Sql Server on 9/7/2009 | Views : 3535 | Status : [Member] | Replies : 1
Hi

For DB migration to SQL SERVER 2008, i need to know how to handle the incompactibilty of "LTRIM" function. In SQL SERVER 6.5, LTRIM('') return NULL where as in 2008, EMPTY STRING is returned (from SQL SERVER 2000 onwards, EMPTY STRING is returned).

This had been already documented in "sp_dbcmptlevel" topic:
http://msdn.microsoft.com/en-us/library/aa259649(SQL.80).aspx

Curently, i am manually looking into all objects where LTRIM or RTRIM are used and adding a condition to return NULL(existing business logic checks for NULL value to perform some action at DB level itself).

Is there any work around or a better approach to address this issue(as there more than 800 DB objects - SPs, User Functions to be checked)?


Thanks




Responses

Posted by: SqlDeveloper on: 9/7/2009 [Member] Starter

Up
0
Down
Hello Manzoor,

At least you can find the list of SPs that LTRIM or RTRIM exists in its codes by running the below query


select distinct object_name(id) 

from syscomments
where text like '%LTRIM%' or text like '%LTRIM%'


I hope that helps,
Eralper
http://www.kodyaz.com

Manzoor_mustafa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response