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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-17 : 07:50:47
|
| adriane writes "select fieldID, combined_data = concat(textfields, ', ')from reqst_input_datainto #TmpRequestedInfowhere fieldID = (select fieldID from MainTable)I'm getting an error message telling me SQL does not recognize 'concat', so I'm getting a sinking feeling I will have to create a function to do this.There can be multiple 'textfields' of varying lengths for each 'fieldID', and I would like to move them all to one large text field.Any suggestions?" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
adriane
Starting Member
7 Posts |
Posted - 2005-11-22 : 15:02:22
|
| Thanks for your quick reply. I appreciate it. The link got me pointed in the right direction I'm sure, but I haven't been able to get the select statement in my view to work efficiently.'Select distinct' will make it run on and on without any result. Removing the 'distinct' will give me output, but of course they are multiple instances for every fieldID - and it still runs very slow. I've had to abort the execute every time.I checked to make sure there is no cartesian join in the view, but I can't find any problem there. Sure wish there was an easier way to do this. Any ideas? |
 |
|
|
druer
Constraint Violating Yak Guru
314 Posts |
Posted - 2005-11-22 : 15:35:40
|
| Have you tried:select fieldid, Textfield1 + TextField2 + TestField3 as CombinedFieldsfrom ....I assume that your MainTable only returns 1 fieldId is that correct? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-23 : 00:17:15
|
| Well.How many rows does your table have?Did you use index for the keycolumn?If distinct from that table wont work, then copy the distinct values to other table and do query based on that tableMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-23 : 00:22:33
|
quote: Originally posted by druer Have you tried:select fieldid, Textfield1 + TextField2 + TestField3 as CombinedFieldsfrom ....I assume that your MainTable only returns 1 fieldId is that correct?
I think the questioner's expected result is not what you specifiedIt there are data like theseId Name1 a1 b1 c2 a2 bThen the result should beId Combined_Name1 a,b,c2 a,b MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|