Solved

MID string

Posted on 2004-04-08
9
2,612 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
  • 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
 
LVL 27

Expert Comment

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

Dabas
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now