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
 General SQL Server Forums
 New to SQL Server Programming
 Memo or append?

Author  Topic 

InNomina
Starting Member

40 Posts

Posted - 2012-05-16 : 12:49:13
I have 3 columns that are text. I need the 4rth column to reflect anything put into the first 3 columns but also allow additional text to be imputed directly into the 4rth column as well.

example...
Column 1 - this
Column 2 - Space
Column 3 - For

Column 4 - this Space For Rent

Any advice is helpfull

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-05-16 : 12:55:08
general database practice is to not duplicate data. So make column 4 just 'Rent'. Then use a query, SP, function, or something to return the full value.

Be One with the Optimizer
TG
Go to Top of Page

InNomina
Starting Member

40 Posts

Posted - 2012-05-16 : 12:56:52
Believe me I agree, that being said "they" area adamant that they want a keyword based on these columns as well as the fourth column being editable.

-------------------------
"If you never fail, you're not trying hard enough"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-05-16 : 13:04:17
So have four columns and include a fifth computed column:

ATLER TABLE myTable ADD column5 AS ISNULL(Column1 + ' ','') + ISNULL(Column2 + ' ','') + ISNULL(Column3 + ' ','') + ISNULL(Column4,'')

By the way, SQL Server doesn't otherwise support what they want. You'd have to use a workaround such as this, or triggers to update the fourth column, which will get very messy very quickly.
Go to Top of Page

InNomina
Starting Member

40 Posts

Posted - 2012-05-16 : 14:04:50
Thank you, that worked perfectly!

-------------------------
"If you never fail, you're not trying hard enough"
Go to Top of Page
   

- Advertisement -