Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic question on MID function 1

Status
Not open for further replies.

psimon1

Technical User
Mar 18, 2003
55
0
0
US
Hello

I'm more of an Access guy and I know that there are differences between Jet SQL and TSQL. We're running SQL server 2005 and I can't seem to find an equivalent to Access' mid function. In other words, I really liked how I could pull part of a record as follows:

MID(NAME, 3,2) AS NAME PART

***

Johnson becomes "ns"

How would I do this in a TSQL command?

Thanks, all.



 
Try the SUBSTRING function. Here's the syntax:

Code:
SUBSTRING ( expression ,start , length )
 
and keep your colum name without spaces or surround it with square brackets NAMEPART, [NAME PART]
And Johnson becomes "hn" I think.

[COLOR=#aa88aa black]Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt.[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top