473,320 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Selecting Values in CSV

I have to write a master detail query, in which the detail record should
be stored in a variable as Comma Seperated Values. Can anyone help
me......

Sun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
5 1548
> the detail record should be stored in a variable as Comma Seperated
Values.

Can you explain what you mean by this? Variables don't store "records". Do
you mean that the data is stored in a *table* in comma delimited format?
Storing delimited values in a database is a very poor design. It violates
basic design principles and is difficult to query, manipulate and maintain
data integrity. Why "should" your data be stored this way?

If you need help writing a query, please post DDL, a few rows of sample data
and show your required result.
http://www.aspfaq.com/5006

--
David Portas
SQL Server MVP
--
Jul 20 '05 #2
Here is what i expect...

I am writing a view, which i am going to use in a Report. Now the
Details field should not repeat on new lines. I want to display it in
One line only.

e.g. Master - Order No, Order Date...
Detail - Order NO, ItemName

There may be 2 or 3 Items in Detail like A and B and C

OrderNO OrderDate Items
1 01/01/2004 A, B, C

Sun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Hi

The only way to do this safely is to write a cursor and concatentate the
value from each record into the variable.

John

"Sunil Gosavi" <su*****@yahoo.com> wrote in message
news:40*********************@news.frii.net...
I have to write a master detail query, in which the detail record should
be stored in a variable as Comma Seperated Values. Can anyone help
me......

Sun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #4
Do you really have ItemName in the Order Detail table? In a properly
normalized design you would normally expect that to exist only in a Products
table and for the order details to look something like this:

CREATE TABLE OrderItems (order_no INTEGER REFERENCES Orders (order_no),
sku_code INTEGER REFERENCES Products (sku_code) ..., PRIMARY KEY (order_no,
sku_code))

To concatenate values into a string for your report is something that would
be better done client-side. Extract all the rows, then loop through them in
your code.

Alternatively, here are some references on producing crosstabs in SQL that
may help you, or Google the archives of the
microsoft.public.sqlserver.programming group for more examples.
http://www.aspfaq.com/2462

--
David Portas
SQL Server MVP
--
Jul 20 '05 #5
Sunil Gosavi (su*****@yahoo.com) writes:
I am writing a view, which i am going to use in a Report. Now the
Details field should not repeat on new lines. I want to display it in
One line only.

e.g. Master - Order No, Order Date...
Detail - Order NO, ItemName

There may be 2 or 3 Items in Detail like A and B and C

OrderNO OrderDate Items
1 01/01/2004 A, B, C


Usually it is better to do this sort of thing in the client.

If you want to persist the report, Microsoft has a new add-on to SQL
Server out, known as Reporting Services. As long as you run Reporting
Services on a machine you already have an SQL Server license for, you
don't need any extra license.

See http://www.microsoft.com/sql for details.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Simon G Best | last post by:
Hello! The C++ standard library provides facilities for finding out the sizes (and other such stuff) of numeric types (::std::numeric_limits<>, for example). What I would like to do is to...
1
by: Alastair Cameron | last post by:
VB6, MSXML 3.2 installed: Q1. I am having a problem selecting nodes with XPATH expressions when an attribute values contain backslashes (\\) in as part of its value: For example the...
2
by: KoliPoki | last post by:
Greetings. I'm having a little trouble with a query. The idea is simple I need to display a list of recently unique visited URLs and the last time I visited. I have 2 table one stores the...
3
by: james.dixon | last post by:
Hi I was wondering if anyone else had had this problem before (can't find anything on the web about it). I have three select elements (list boxes - from here on I'll refer to them as 'the...
0
by: Hijax | last post by:
Hi, What about posgtesql performace in selecting from million of records? I have a database with about 23 miilion of touples in single table. Data represents a analog signal values from...
1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
1
by: Bob Loveshade | last post by:
I am looking for an example that shows how to select and highlight multiple rows in a DataGrid. My DataGrid is part of a Web User Control which is contained in an ASPX page. I haven't been...
2
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
1
by: reshma | last post by:
I have one password field, confirm password field, combo box in one panel. There are 2 more panels - one for individual and another for corporate. After entering password and confirm password, i...
5
by: hollyquinn | last post by:
Hi I am working with a web application where I am selecting values from a SQL Server 2005 database and then loading the values into different controls on my page. Most of the values load with no...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.