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 |
|
kvelu
Starting Member
1 Post |
Posted - 2002-08-05 : 09:05:53
|
| how to use array data type in TSQL (sybase stored procedure).Thanks,Kumar<edit>moved to developer forum</edit>Edited by - robvolk on 08/05/2002 10:12:08 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-05 : 09:10:40
|
| A. We're a SQL Server site, we don't support Sybase.B. SQL Server does not have an array datatype, and AFAIK neither does Sybase.C. You can simulate array parameters using comma-separated values (CSV). Try these links:http://www.sqlteam.com/SearchResults.asp?SearchTerms=csv |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-08-05 : 10:14:28
|
| This question comes up a lot...a product of applications developers getting into DBMSs I guess...Rob, I'm curious why you always push a CSV as a way to simulate the concept of an array rather than suggesting a table? I suppose it depends greatly on what the person is trying to accomplish, but I think using a table to handle a list is far more flexible. (Granted, you can't pass a table into an an IN param to a proc...) Your thoughts?Jay White{0} |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-05 : 10:27:49
|
quote: (Granted, you can't pass a table into an an IN param to a proc...) Your thoughts?
...coincide with your thoughts in this regard. The (albeit) subtle differences between a table and array are the main issue. A 2D array is accessed using the (m, n) syntax specifying a row and column NUMBER. Now, I don't need to remind YOU of proper database theory about treating columns and/or rows as having ordinal significance. In promoting the idea that "tables are the same as arrays" it's no great leap to assume that people will automatically add row numbers to their tables, and create columns like "col1, col2, col3..." that store the exact same data instead of creating a more normalized structure.Let's not forget that "arrays are procedural programming constructs" (hey! I could swear I've heard SOMEONE say this before!) that don't function well in a set-based language like SQL, and that trying to make them work will only lead to less-efficient, non-set-based code and database design. I'm not knocking arrays, but they don't belong in a SQL database IMHO, and making a table look and act like an array is usually more trouble than it's worth. |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-08-05 : 11:07:10
|
quote: arrays are procedural programming constructs
Is MDX procedural, then? |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-08-05 : 11:13:11
|
quote: Is MDX procedural, then?
Kinda an apples and oranges question, isn't it?Is a multi-dimensional DW relational?Jay White{0} |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-08-05 : 11:31:48
|
Originally, I was going to say APL, but that's old and grotty and does have some procedural features. Then I was going to say J, but I didn't think that many people would know J... then I had a crisis and wondered if I really meant K, not J (I don't think I did after all)... and then I thought of the way dimension members are ordered in MDX, especially since MDX is superficially like SQL (a bit). Unfortunately, the MDX stuff in BOL includes gems like this: "An ordered collection of tuples is referred to as a set."So I wish I'd never bothered now Edited by - Arnold Fribble on 08/05/2002 11:36:08 |
 |
|
|
|
|
|
|
|