MS SQL 2000 Server database
-
I have a 1 row record with several columns SectB1, SectB2, SectC1, SectC2 etc. In SectA1 cell, I have something like M1Y1472: All I want to do is to have |M|1|Y|1|47|2, that is eveything in its column. The same hing has to happen to SectB2, SectC1, SectC2 etc. Finally, I will have something like: B1 B2 B3 ....C1 .....Cn M 1 2 F 1 1 F 1 1 M 1 1 M 5 2 1 M 6 2 1 F 2 1 thank you phokojoe
-
I have a 1 row record with several columns SectB1, SectB2, SectC1, SectC2 etc. In SectA1 cell, I have something like M1Y1472: All I want to do is to have |M|1|Y|1|47|2, that is eveything in its column. The same hing has to happen to SectB2, SectC1, SectC2 etc. Finally, I will have something like: B1 B2 B3 ....C1 .....Cn M 1 2 F 1 1 F 1 1 M 1 1 M 5 2 1 M 6 2 1 F 2 1 thank you phokojoe
-
I have a table with rows and columns. In a column, say A I have cell contents as 12345 etc. That is i have something like: Column Row 12345 Now what I want to do is to separate the numbers in that cell as in 1 23 4 5, so that 1 is in its column, 23 in its column, 4 in its column 5 in its column but all in the same row: Column1 Column2 Column3 Column4 Row 1 23 4 5 If I can be helped in that one cell, I think I will be able to handle the other cells. help needed urgently! phokojoe
-
I have a table with rows and columns. In a column, say A I have cell contents as 12345 etc. That is i have something like: Column Row 12345 Now what I want to do is to separate the numbers in that cell as in 1 23 4 5, so that 1 is in its column, 23 in its column, 4 in its column 5 in its column but all in the same row: Column1 Column2 Column3 Column4 Row 1 23 4 5 If I can be helped in that one cell, I think I will be able to handle the other cells. help needed urgently! phokojoe
-
I have a table with rows and columns. In a column, say A I have cell contents as 12345 etc. That is i have something like: Column Row 12345 Now what I want to do is to separate the numbers in that cell as in 1 23 4 5, so that 1 is in its column, 23 in its column, 4 in its column 5 in its column but all in the same row: Column1 Column2 Column3 Column4 Row 1 23 4 5 If I can be helped in that one cell, I think I will be able to handle the other cells. help needed urgently! phokojoe
-
I have a table with rows and columns. In a column, say A I have cell contents as 12345 etc. That is i have something like: Column Row 12345 Now what I want to do is to separate the numbers in that cell as in 1 23 4 5, so that 1 is in its column, 23 in its column, 4 in its column 5 in its column but all in the same row: Column1 Column2 Column3 Column4 Row 1 23 4 5 If I can be helped in that one cell, I think I will be able to handle the other cells. help needed urgently! phokojoe
-
Maybe you can do it in your code. You save the data as 1,23,4,5. Read the data, when "," is found put it into the next column. I can't help much, if you didn't give more information.
Work hard, Work effectively.
Ok! Thank you for responding. All I can say for example column1 will hold Gender, Column2 will hold Age, column3 will hold say Position" Initially, I have: Column Row 12345 And like I said all I want is a procedure or a way of having it like this: Gender Age Position Class Row 1 23 4 5 I hope this time I have made it clear. Thanks once again!! phokojoe
-
Ok! Thank you for responding. All I can say for example column1 will hold Gender, Column2 will hold Age, column3 will hold say Position" Initially, I have: Column Row 12345 And like I said all I want is a procedure or a way of having it like this: Gender Age Position Class Row 1 23 4 5 I hope this time I have made it clear. Thanks once again!! phokojoe
-
For that you can use,
insert into tableName(gender,age, position, class) values (1,23,4,5)
Why do you want to separate it, when you can do it easily with the way above?
Work hard, Work effectively.
It looks like you do not understand. What I am saying is that my dataset is in this form: Column(Data) Row 12345 which is (Gender age position and class concatenated together). that is I have in a cell column a data in that form and all I want to do is to separate the contents of the column(Data) to separate that and have Gender Age Position Class Row 1 23 4 5 I think now it makes more sense. The insert statement I have used it many times and have no problem with that. phokojoe
-
It looks like you do not understand. What I am saying is that my dataset is in this form: Column(Data) Row 12345 which is (Gender age position and class concatenated together). that is I have in a cell column a data in that form and all I want to do is to separate the contents of the column(Data) to separate that and have Gender Age Position Class Row 1 23 4 5 I think now it makes more sense. The insert statement I have used it many times and have no problem with that. phokojoe
:confused: Is the problem solved? What I'm saying is you don't need to save the data in 1 column, if you have gender, save it in the gender column, etc. You're just making trouble for your self. I hope, I didn't miss understood you.
Work hard, Work effectively.
-
:confused: Is the problem solved? What I'm saying is you don't need to save the data in 1 column, if you have gender, save it in the gender column, etc. You're just making trouble for your self. I hope, I didn't miss understood you.
Work hard, Work effectively.
Thanks Yulianto. I will try not to create trouble for myself. The reson why I had that kind of a situation is that, I used a scanner to capture data , so in my questionnaire design, I had group the variables like that so as not to crowd the questionnaire. Thank you phokojoe
-
Maybe you can do it in your code. You save the data as 1,23,4,5. Read the data, when "," is found put it into the next column. I can't help much, if you didn't give more information.
Work hard, Work effectively.
-
Yulianto Can you show me a line of code whereby if I have data stored in as 1,2,3,4 and I want to read data set, when I find "," I put it in a next clolumn. Sy, when read a data set 1 when i find "," i put 1 in the next column. phokojoe
-
phokojoe wrote: read data set, when I find "," I put it in a next clolumn Are you going to save from the data set? I don't get it. :doh:
Work hard, Work effectively.
-
I will read that data from a table and then save it to another table. I think the code that you are going to show me, I will create a stored procedure and then run it to save it to another table. I think, I have made my point clear. thank phokojoe
You're stil making trouble for your self. Anyway, use
PATINDEX
, to get the string between comma. If your string 'a,b,c' then, the first PATINDEX will get 'a', the second will get 'b', and so on. Then you can update/copy the field using the value you got. Here's the basic code:declare @name varchar(15) set @name='agf,b,c' select substring(@name,1,patindex('%,%',@name)-1)
Work hard, Work effectively.
-
You're stil making trouble for your self. Anyway, use
PATINDEX
, to get the string between comma. If your string 'a,b,c' then, the first PATINDEX will get 'a', the second will get 'b', and so on. Then you can update/copy the field using the value you got. Here's the basic code:declare @name varchar(15) set @name='agf,b,c' select substring(@name,1,patindex('%,%',@name)-1)
Work hard, Work effectively.