October 27, 2008 at 7:59 am
I have a table that has a few fields that will normally appear together, along with some text, but that I want to keep as discreet fields. What is the best way to persist this?
I have these fields, all nVarChar(10):
FIELD1
FIELD2
FIELD3
FIELD4
On both input and output, I will almost invariably consider them together, like so:
[FIELD1]/[FIELD2]/[FIELD3]/[FIELD4]
In other words, I would like to refer to them as "MyFields" and have them appear like so, with the slashes between them, both during data entry and for Reporting Services.
Ie: In reporting services I want a field called "MyFields" which has that concatention.
Does this call for a Calculated Field in the schema? A view? Something else?
I'm a newbe.
Thanks,
"What I lack in youth I make up for in immaturity!"
Please visit my music site at http://woundedego.com
October 27, 2008 at 8:08 am
a calculated field would do the trick: add a column to your table like this:
ALTER TABLE MYTABLE ADD
MYFIELD AS COALESCE(FIELD1,'') + '/'
+ COALESCE(FIELD2,'') + '/'
+ COALESCE(FIELD3,'') + '/'
+ COALESCE(FIELD4,'')
Lowell
October 27, 2008 at 8:16 am
Thanks for the answer.
I apologize for the dup posts. I can't seem to avoid it. And I tried to delete it twice, but it would not delete!
"What I lack in youth I make up for in immaturity!"
Please visit my music site at http://woundedego.com
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply