If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > error having muultiple values in one database field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-07-04, 11:32
kapturedsoul kapturedsoul is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
error having muultiple values in one database field

I have a query I am just starting...but have already run into a problem

Select 'test, ' as module,
(Select title + ' '
From test_documents) as text_text
From test_table

So there are multiple rows in the test_document table and I want ALL of those to be in test_text.

So...I want test_text to look like:

title1 title2 title3

I am using it as text to be indexed and searched.

Thanks sooo much for any ideas!!!
Reply With Quote
  #2 (permalink)  
Old 06-07-04, 12:18
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
I'm not sure that I understand what you're asking. If you are trying to create a table with multiple values in a single column, that is a really, REALLY bad thing to do! If you are trying to create a cross-tab query that builds a list of the values in some column for all of the rows that meet some condition, that is better done on the client, although it can be done in the database too.

Can you give us a better "real world" description of what you are trying to do, that will probably help more than anything.

-PatP
Reply With Quote
  #3 (permalink)  
Old 06-07-04, 12:23
kapturedsoul kapturedsoul is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
I basically am trying to make a View...that I will use for searching....

those titles : title1 title2 title3

would be in one column named search_text

that will be indexed by my search...

I know that when I run my scheduled file to index I could do some code there to combine all the fields....just wanted the smalles amount of processing time as indexing takes long enough.

so basically if the user searches any of those title names...it would bring up one result ...
Reply With Quote
  #4 (permalink)  
Old 06-07-04, 13:27
kapturedsoul kapturedsoul is offline
Registered User
 
Join Date: Jun 2004
Posts: 3
declare @string varchar(1000)

select @string = ''

select @string = rtrim(@string) + [Your_Column] + ','

from [Your_Table]

select substring( @string, 1, len(@string) - 1)


This works.....then I can just can do another select with my other fields and it works great
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On