467,149 Members | 1,351 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,149 developers. It's quick & easy.

sql server procedure

hi friends, i am new to sql server2005 and i want to create a procedure or cursor
which would work like, i have two table one having the country codes and another having the dialed digits along with the country codes, the problem is i want to select one countrycode match that code with the records from dialed digits table and extract all the record to a temp table and after that want to calculate the total record and sum of their minutes the data look like this

country table

mexico | 52
guatemala | 502
India | 91
pakistan 92
SriLanka |94

dialed digits table

07/23/2008 00:00:04 | 7809787411 | 919911599771 | 1163 | 1163 | 0.755950
07/23/2008 00:00:20 | 6046858944 | 919868012693 | 205 | 205 | 0.133250
07/23/2008 00:00:29 | 6048200105 | 911635269141 | 1039 | 1039 | 0.769899
07/23/2008 00:00:32 | 3032432360 | 50278440297 | 6 | 6 | 0.005250
Sep 19 '08 #1
  • viewed: 934
Share:
1 Reply
ck9663
Expert 2GB
You need to parse the dialed number to get what we call Significant Dialed Digit. You have to read the entire dialed number and do reduce the length one at a time coming from the right until you found a matching on your COUNTRY CODE - AREA CODE table. The reason is, there are countries that has almost similar COUNTRY+AREACODE but are different country (ie CANADA and US). Then you can direct the result to a table and do whatever you need to.

-- CK
Sep 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by gilles27@talk21.com | last post: by
21 posts views Thread by rkusenet | last post: by
26 posts views Thread by David W. Fenton | last post: by
9 posts views Thread by billmiami2@netscape.net | last post: by
10 posts views Thread by J. S. EDV | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.