What's the equivalent of the EXCEL MID FUNCTION SQL Server 2008

Hi Experts,
I have the following function in EXCEL (see below), how can I write this same function in SQL Server 2008 R2?
I don't believe there is a MID function in SQL.  What do I use instead?

=(MID(C4,1,1)*3)+(MID(C4,2,1))+(MID(C4,3,1)*3)+(MID(C4,4,1))+(MID(C4,5,1)*3)+(MID(C4,6,1))+(MID(C4,7,1)*3)+(MID(C4,8,1))+(MID(C4,9,1)*3)+(MID(C4,10,1))+(MID(C4,11,1)*3)+(MID(C4,12,1))+(MID(C4,13,1)*3)+(MID(C4,14,1))+(MID(C4,15,1)*3)+(MID(C4,16,1))+(MID(C4,17,1)*3)

Thank you very much in advance,
mrotor
mainrotorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lokesh B RDeveloperCommented:
Hi,

You can use SUBSTRING in SQL.

(SUBSTRING(C4,1,1)*3)+(SUBSTRING(C4,2,1)) + (SUBSTRING(C4,3,1)*3)+(SUBSTRING(C4,4,1))+(SUBSTRING(C4,5,1)*3)+(SUBSTRING(C4,6,1))+(SUBSTRING(C4,7,1)*3)+(SUBSTRING(C4,8,1))+(SUBSTRING(C4,9,1)*3)+(SUBSTRING(C4,10,1))+(SUBSTRING(C4,11,1)*3)+(SUBSTRING(C4,12,1))+(SUBSTRING(C4,13,1)*3)+(SUBSTRING(C4,14,1))+(SUBSTRING(C4,15,1)*3)+(SUBSTRING(C4,16,1))+(SUBSTRING(C4,17,1)*3)

Open in new window


https://msdn.microsoft.com/en-us/library/ms187748.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vitor MontalvãoMSSQL Senior EngineerCommented:
mainrotor, do you still need help on this question?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.