Solved

MID string

Posted on 2004-04-08
9
2,619 Views
Last Modified: 2008-03-17
How do I do a Mid string function in SQl. I can do a Left(string, 4) and right function.....but how do I do the Mid??
0
Comment
Question by:AutomaticSlim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 27

Accepted Solution

by:
Dabas earned 20 total points
ID: 10788237
Hi AutomaticSlim:
Try SubString

SUBSTRING (T-SQL)
Returns part of a character, binary, text, or image expression. For more information about the valid Microsoft® SQL Server™ data types that can be used with this function, see Data Types.

Syntax
SUBSTRING(expression, start, length)

Arguments
expression
Is a character string, binary string, text, image, a column, or an expression that includes a column. Do not use expressions that include aggregate functions.
start
Is an integer that specifies where the substring begins.
length
Is an integer that specifies the length of the substring (the number of characters or bytes to return).

Dabas
0
 

Author Comment

by:AutomaticSlim
ID: 10788381
I know the Start of the string but the length depends, it could be 5,6,10 ...
and I want what ever it is after start...
0
 
LVL 10

Assisted Solution

by:Shailesh15
Shailesh15 earned 20 total points
ID: 10788395
Use substring(string,startofstring, len(String)-startofstring)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:Dabas
ID: 10788396
AutomaticSlim:
SUBSTRING(expression, start, Len(Expression)-start)

Dabas
0
 
LVL 27

Expert Comment

by:Dabas
ID: 10788401
LOL. Got beat by seconds!
0
 
LVL 10

Expert Comment

by:Shailesh15
ID: 10788446
Don't worry.. he will split points!... :)
0
 
LVL 27

Expert Comment

by:Dabas
ID: 10788463
Shailesh15:
LOL. If we are lucky...
AutomaticSlim: You have questions open that are up to a year old!!!!!

Dabas
0
 

Author Comment

by:AutomaticSlim
ID: 10788574
Sorry guys...... I don't have the "split point" option since the number of points are too small.......


Dabas -

Which question are you refereing to that is almost a year old? I want to clean them up.....
0
 
LVL 27

Expert Comment

by:Dabas
ID: 10788646
6 open questions:
04/09/04 http://www.experts-exchange.com/Q_20948459.html "MID string"
03/10/04 http://www.experts-exchange.com/Q_20913102.html "Drop Down Menue bar Goes Under the Optio..."
02/26/04 http://www.experts-exchange.com/Q_20897925.html "SQL Server Remore Admin"
12/03/03 http://www.experts-exchange.com/Q_20814559.html "Query returns duplicates"
11/25/03 http://www.experts-exchange.com/Q_20807267.html ".aspx color coding in ASP.NET environmen..."
04/28/03 http://www.experts-exchange.com/Q_20598329.html "Having 2 Databases in Sync"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question