Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 3rd, 2007, 07:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I (almost) always do such aggregation in the client code, on the theory that it is actually a presentation issue and not a data one. That way, I can put things in whatever order I want. And besides, string manipulation in TSQL is very slow, anyway...

(BTW, I thought I read somewhere that xp_sendmail is deprecated in SQL Server 2005...)

Jeff Mason
Custom Apps, Inc.
[email protected]
 
Old April 3rd, 2007, 09:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I use the sp_send_cdosysmail procedure for sending emails. Not sure if that is deprecatedin sql server 2005. Need to check on that.

_________________________
- Vijay G
Strive for Perfection
 
Old April 10th, 2007, 08:39 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

agreed it's a dead horse. In reading what I typed vs what I can see how what I said can be misunderstood. Here is a restatement of what I am trying to say and said so poorly previously. I typed my previous posts assuming people would follow my thoughts without clearly stating them.

If you insert data into a table in one order, there is no guarantee it will be returned in the same order as the original poster appears to imply it will. To begin to do the logic that he is proposing he will need to add a identity (sequence for oracle types) to his data to insure it is returned in the same order inserted. This will have problems if multiple people are inserting at the same time. Then they will have to select the data with an order by on the identity value to get the data in the same order inserted. Then after that the poster can begin to apply the logic he is trying to apply. That is what I tried so poorly previously to point out.

 
Old August 14th, 2008, 08:36 AM
Registered User
 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok so forgive me if this is the totally wrong thread.

I am a network admin, and my experiance with SQL is installing it, maintaining and backing it up.

However, with very short notice I am having to learn/get help with the development side, or at least figure this issue out. In 8 hours of looking in all the wrong places of course I wont understand, what you guys can do.

Maybe what I need is simple.

I have a table name Custom 2 that look like so

cparent_alias custom_alias c_desicrpt col 4
000018 00565 0009 y
000018 00565 0008 n

Cparent and custom_alias each have a column full of number and so on.

I need to
1. create a new table for the new data
2. have a row within the table that combines "cparent_alias" and "custom_alias" and adds a period (.)

so I will have a table that has info like

00018.00565
00018.00565
and.. so on..

the other 2 columns are not needed.

Hopefully that made some kind of sense.

thanks in advance for any help.
 
Old August 14th, 2008, 09:17 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

This is a new question, start a new posting rather than tag onto an old one.
You have at least two choices, you can create the new table with the extra column of type (n)varchar(xxx) where x is the sum of the two columns you are concatenating, the table is called called Custom3.
Then INSERT using:
INSERT [Custom3] (cparent_alias, custom_alias, c_descript, col4, newColumn)
SELECT cparent_alias, custom_alias, c_descript, col4, cparent_alias + '.' + custom_alia;

This assumes the columns to be concatenated are a text type, if not then:
INSERT [Custom3] (cparent_alias, custom_alias, c_descript, col4, newColumn)
SELECT cparent_alias, custom_alias, c_descript, col4, CAST(cparent_alias AS nvarchar(50)) + '.' + CAST(custom_alia AS nvarchar(50));
Second option is to use a computed column where the data is computed by SQL Server on an ongoing basis. The advantage of this is that if you add a new row to the table the [newColumn] will have the correct value without you doing any extra work. Search Books On Line for COMPUTED COLUMN. Basically you declare newColumn AS cparent_alias + '.' + custom_alias [/code]

There are examples here: http://msdn.microsoft.com/en-us/library/ms174979.aspx
In my opinion this whole request looks suspicious and I would question the wisdom in creating such a table aklthough one possibility would be to create a reporting table.


--

Joe (Microsoft MVP - XML)
 
Old August 14th, 2008, 09:28 AM
Registered User
 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Joe I will give it a shot.






Similar Threads
Thread Thread Starter Forum Replies Last Post
concatenating records rashi Access VBA 9 November 6th, 2008 05:07 PM
Concatenating strings of code sassora Word VBA 1 March 31st, 2006 02:39 PM
Concatenating many XML files srivalli9 XML 4 March 30th, 2006 03:05 AM
Concatenating column values arnabghosh Access 1 September 21st, 2005 06:45 AM
concatenating arrays allee_man BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 August 19th, 2005 08:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.