|
What's the pattern? Why does 1 in its column and 23 in another column?
<italic>Work hard, Work effectively.
|
|
|
|
|
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.
<italic>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
|
|
|
|
|
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?
<italic>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
|
|
|
|
|
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.
<italic>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
|
|
|
|
|
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.
<italic>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)
<italic>Work hard, Work effectively.
|
|
|
|
|
Thank you. it worked
phokojoe
|
|
|
|
|
I am trying to learn how to do a running total in Reporting Services. I have gone to the msdn website, but get bounced around from link to link. I just need a point in the right direction to learn how to do this please!
Scott Moore
|
|
|
|
|
I am trying to do a sql with wildcards in the "LIKE"
I tried _ and ? they wont work. * and % are working fine but i want some thing to match a single character. example
LIKE _ean
should return sean but it doesnt
any ideas????
Cheers
|
|
|
|
|
What do u mean by didn't work?
Can you post your code and the undesireable results ?
|
|
|
|
|
I am using the SQL Server Reporting service for creating the Reports but I am unable to create the Sub reports using the same. I've set the parameter property but the subreport is not visible in runtime. Can aybody have any idea how to create the Sub Reports.
Prashant Shinde
|
|
|
|
|
Hello friends!!
Please guide me where i will find best documents regarding craeting of "Stored_Procedure"
T.I.A
Shashank
|
|
|
|
|
|
Hi,
I'm new to programming (C#) and I can't find a sample of OleDb Transactions that can rollback BOTH ExecuteNonQuery() and myDataAdapter.Update all in one try/catch statement.
I found this link that shows the ExecuteNonQuery...
http://msdn2.microsoft.com/library/h8459s0c(en-us,vs.80).aspx
Is it possible to have both ExecuteNonQuery and DataAdapter.Update in the same rollback transaction?
thanks,
Ron
|
|
|
|
|
Hi all,
I'm currently trying to write a few lines into a csv file from a sql package. One thing I have to make sure is that the csv file doesn't end with a blank line. That is, I have to delete all new line and return feed from the end of the file. I've tried:
fileOut := utl_file.fopen('xxx', 'yyy', 'W', 32760);
utl_file.put_line(fileout, 'line 1' || Chr(13));
utl_file.put(fileout, 'line 2');
utl_file.fclose(fileOut);
But when I open the csv file created, there's always a blank line at the end of the file. It seems like a blank line is always being appended to the end of the file automatically on file close. Is this true? And are there any ways of avoiding this through sql?
Thanks
|
|
|
|
|
I created an address book with a login dialog box. It works fine. Now I would like to change the password and or user id. How can I do that?
bravo659
|
|
|
|
|
Magic.
For a better answer, you'll need to tell us how you created your login box in the first place. Given that you're in the SQL forum, I'm hoping you have a database with a table of usernames and passwords. If that is so, I'd have thought all you need to do is add to this table.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
you need to do is add edit to this table.
<italic>Work hard, Work effectively.
|
|
|
|
|
Depends on what you mean by edit. He needs to add a row if he wants to add a new user, assuming everything is set up decently.
However, if you regard adding a row as editing, and adding a column as adding, then you'd be right.
Christian Graus - Microsoft MVP - C++
|
|
|
|