| Author |
Topic |
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-01-05 : 10:43:41
|
| Hi All.I keep in column ContactInfo phone number and email address. How to select string with @ character by condition in select statement?Thanks. |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-05 : 11:01:10
|
| do you have some delimiter between phone number and email values at least?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-01-05 : 11:04:29
|
| Phone number is number string. Email has @ character. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-05 : 11:08:30
|
| who told?its valid to have email address like 123somename@somedomain.comso merging with phonenumber 12342345345 without any delimiter it will become 12342345345123somename@somedomain.comthen question is how would you identify which part is phone number and which is emailalso phone number can come with or without code so you cant rely upon number of digits too------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-01-05 : 14:51:25
|
| ID | ContactInfo----+-------------------2 11111111114 222225 sa@dsa.org6 15912345647 hgfh@kjh.com8 33333 |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-01-05 : 16:56:59
|
| Thanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-06 : 13:54:50
|
| i didnt understand why you're storing different attributes inside same field. why not make field generic and have another field to indicate the type like 1= email, 2= phonenumber, 3=fax etcyou can even have a different type table to store master entries for contact type and use its id as foreign key in your table to increase flexibility and scalability------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2012-01-06 : 14:11:51
|
quote: Originally posted by visakh16 i didnt understand why you're storing different attributes inside same field. why not make field generic and have another field to indicate the type like 1= email, 2= phonenumber, 3=fax etcyou can even have a different type table to store master entries for contact type and use its id as foreign key in your table to increase flexibility and scalability------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Or why not normalize the data in to separate tables?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-06 : 14:14:05
|
| Even thats an option so long as you dont have too many contacttypes and they wont have too many NULL values in which case you've to make them Sparse column------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-07 : 02:32:42
|
| In case all persons wont have all contactinfo types most of columns will have NULL values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|