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 |
|
andryi
Starting Member
17 Posts |
Posted - 2009-10-07 : 12:40:20
|
| Hi all, how can I have an array of variables, I mean, how can create one variable by each rowin a table |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2009-10-07 : 12:50:01
|
| There is not an array construct in the T-SQL language. Perhaps if you can elaborate on what you would like to accomplish, someone can offer some insight.=======================================Few things are harder to put up with than the annoyance of a good example. (Mark Twain) |
 |
|
|
andryi
Starting Member
17 Posts |
Posted - 2009-10-07 : 12:58:15
|
| thank's for answer Bustaz Kool, well for exampleIf I have thiscreate table Client( ID int, name varchar(50), direction varchar(50), description varchar(50),)So, I have 4 columns of the table Clientand I'd like to have for variables@Id int,name varchar(50),direction varchar(50),description varchar(50)but with an array I supposed because, if other table have 10 columnsI want that array(suppously), can create 10 variables of the 10 columns of this tableSo, how can I do it? |
 |
|
|
andryi
Starting Member
17 Posts |
Posted - 2009-10-07 : 13:00:46
|
| or in another case, If I have a table with 4 rowsHow can I create 1 variable by each row |
 |
|
|
andryi
Starting Member
17 Posts |
Posted - 2009-10-07 : 13:08:23
|
| mmmm more clear, is this:select ROW_NUMBER() OVER (ORDER BY name ) AS [ROW_NUMBER],name from syscolumns where id=object_id('TableName')and I have this:ROW_NUMBER | name--------------------- 1 | code 2 | name 3 | description 4 | detailso I have the name of the column of the table and an "index" my question is, how can pass each 'name of column' to one variable distinct of otherlike this: code--->@codename--->@namedescription--->@descriptiondetail--->@detailbut without create the variables one by one manually |
 |
|
|
|
|
|
|
|