Select Mid() in MS SQL Server 7

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

savagej21

Thread Starter
Joined
Nov 14, 2001
Messages
4
I am trying to use the select mid command in SQL Server 7, only to learn that it's not supported--Does anyone know how to do this? Here's what I'm trying to do.

I want to break a 10-digit phone number into area code, prefix, and last four digits. In Oracle SQL I would type:

select left(PhoneNumber,3) as 'AreaCode, mid(PhoneNumber,4,3) as 'Prefix', right(PhoneNumber,4) as 'Last4Digits'.

However when I try to do this in SQL Server Query Analyzer, I receive a notice that 'mid' is not a function.

Help! :) Thanks in advance.:confused:
 
Joined
Oct 13, 2000
Messages
941
You might play with this. Note that it's pulling bytes, so look out for unicode.

If you are in fact working with binary data, you should read this bug report, too, though it does not mention mid--does mention the other string functions, tho. Have you searched SQL Server help for string functions?
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top