separate the content of field
-
I have a table that it has a field with nvarchar datataype. the content of this field Containing different of information such as phone number,address and ... how do I grouping it In various fields?
-
I have a table that it has a field with nvarchar datataype. the content of this field Containing different of information such as phone number,address and ... how do I grouping it In various fields?
Not enough information. Please provide more details as follows: How many different information is contained in the field? Is the number of different information fixed? Is the sequence of different information fixed? How are they being separated (by comma or single space)?
-
I have a table that it has a field with nvarchar datataype. the content of this field Containing different of information such as phone number,address and ... how do I grouping it In various fields?
f,amiri882 wrote:
the content of this field Containing different of information such as phone number,address and ...
X|
f,amiri882 wrote:
how do I grouping it In various fields?
You shouldn't; the correct way would be to have a separate field for each of those attributes.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
I have a table that it has a field with nvarchar datataype. the content of this field Containing different of information such as phone number,address and ... how do I grouping it In various fields?
Assuming your field values is comma separated and is of fixed number, check out this example at sql fiddle. It spilts the multiple-value field and insert them into a new table with separate fields. Adapt it to suit your need.
-
Not enough information. Please provide more details as follows: How many different information is contained in the field? Is the number of different information fixed? Is the sequence of different information fixed? How are they being separated (by comma or single space)?
some record containing 2 or 3 phone number that separate with space or 2dash or 3dash or ... some record containing a sequenece of string or some record containing both of them.
-
f,amiri882 wrote:
the content of this field Containing different of information such as phone number,address and ...
X|
f,amiri882 wrote:
how do I grouping it In various fields?
You shouldn't; the correct way would be to have a separate field for each of those attributes.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
what?I don't underestnad :|
-
some record containing 2 or 3 phone number that separate with space or 2dash or 3dash or ... some record containing a sequenece of string or some record containing both of them.
Your table is in a mess, there is no fixed structure at all. The only way out is to do a manual clean up, and before that do remember to backup a copy of the original table. You must at least put in place some structure, say 'name', 'address', 'phone' that is comma separated and in fixed order and fixed number. Only then, you can use my solution to split and insert them into a new table. Work hard.
-
Your table is in a mess, there is no fixed structure at all. The only way out is to do a manual clean up, and before that do remember to backup a copy of the original table. You must at least put in place some structure, say 'name', 'address', 'phone' that is comma separated and in fixed order and fixed number. Only then, you can use my solution to split and insert them into a new table. Work hard.
Peter, can you do us a favour and not edit spam questions in QA? The instructions from Chris are to not edit the spam messages, just report them as spam and let the community (or a protector) delete them. The reasoning seems to be that from time to time he tries new spam filters and if you edit the message, then they "learn" what is and isn't spam from the edited message, which is no use! Leaving them untouched, but hitting the "spam" button sends the unedited content to the filter, and it shoudl learn to distinguish real spam better. Thanks!
Never underestimate the power of stupid things in large numbers --- Serious Sam
-
Peter, can you do us a favour and not edit spam questions in QA? The instructions from Chris are to not edit the spam messages, just report them as spam and let the community (or a protector) delete them. The reasoning seems to be that from time to time he tries new spam filters and if you edit the message, then they "learn" what is and isn't spam from the edited message, which is no use! Leaving them untouched, but hitting the "spam" button sends the unedited content to the filter, and it shoudl learn to distinguish real spam better. Thanks!
Never underestimate the power of stupid things in large numbers --- Serious Sam
Sorry.
-
Your table is in a mess, there is no fixed structure at all. The only way out is to do a manual clean up, and before that do remember to backup a copy of the original table. You must at least put in place some structure, say 'name', 'address', 'phone' that is comma separated and in fixed order and fixed number. Only then, you can use my solution to split and insert them into a new table. Work hard.
can I use length of field?because the length of fields containing a sequence string is very more than phone number,and fields their length is less than phone number is other type information. I think with this way,problem solve but I don't know code.
-
Sorry.
No need to apologize - you weren't to know! :laugh:
Never underestimate the power of stupid things in large numbers --- Serious Sam
-
Assuming your field values is comma separated and is of fixed number, check out this example at sql fiddle. It spilts the multiple-value field and insert them into a new table with separate fields. Adapt it to suit your need.
thx for your link.
-
can I use length of field?because the length of fields containing a sequence string is very more than phone number,and fields their length is less than phone number is other type information. I think with this way,problem solve but I don't know code.
I suggest you read this to learn how to manipulate string in sql: T-SQL: RIGHT, LEFT, SUBSTRING and CHARINDEX Functions. Good luck.
-
I suggest you read this to learn how to manipulate string in sql: T-SQL: RIGHT, LEFT, SUBSTRING and CHARINDEX Functions. Good luck.
Can you help me further?
-
Can you help me further?
The real learning comes from doing it yourself. No effort no gain. Have confidence in yourself. If you still encounter problems after trying, then come back to post your problems in the quick answer section.
-
The real learning comes from doing it yourself. No effort no gain. Have confidence in yourself. If you still encounter problems after trying, then come back to post your problems in the quick answer section.
I used this link,but I am having trouble.because some records is exception.
-
The real learning comes from doing it yourself. No effort no gain. Have confidence in yourself. If you still encounter problems after trying, then come back to post your problems in the quick answer section.
can I use SQl-CLR for this problem?
-
I have a table that it has a field with nvarchar datataype. the content of this field Containing different of information such as phone number,address and ... how do I grouping it In various fields?
is there the C# code for this problem?
-
is there the C# code for this problem?