Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 non-normalized query where d<>a++b++c [SOLVED]

Author  Topic 

mightytater
Starting Member

3 Posts

Posted - 2011-10-24 : 14:43:59
Hey all,

I have a non-normalized database supporting a legacy application, that displays text from a single column, column D. Column D is actually derived from column A ++ column B ++ column C. Occasionally, either column A or column C may have leading or trailing spaces.

How can I
SELECT * from MYTABLE
WHERE COLUMN_C <> trim(trim(COLUMN_A ++ COLUMN_B) ++ COLUMN_C)

Many thanks!
Matt

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-10-24 : 14:49:27
I'm not sure I understand your question 100%, but maybe this will help?
SELECT * from MYTABLE
WHERE COLUMN_C <> LTRIM(RTRIM(COLUMN_A)) + COLUMN_B + LTRIM(RTRIM(COLUMN_C))
Go to Top of Page

mightytater
Starting Member

3 Posts

Posted - 2011-10-24 : 15:10:20
Oh good grief, could it be that simple?

Many thanks!
Go to Top of Page
   

- Advertisement -