Example on SQLSERVER substring function

Posted by Self-innovator under Sql Server on 1/9/2012 | Points: 10 | Views : 58048 | Status : [Member] | Replies : 7
Sql server substring function sample...Sql server substring function sample...

Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Naraayanan on: 1/9/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check this link
http://www.sql-server-helper.com/tips/split-name.aspx

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 1/9/2012 [Member] Silver | Points: 25

Up
0
Down

select LEFT('sanjay',5)
select SUBSTRING('sanjay',1,5)


try this

Thanks,
Sanjay

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 1/9/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Try this...

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

http://www.dotnetfunda.com/articles/article476-sql-server-substring-explained.aspx

For more reference... search with google...

Thanks,
T.Saravanan

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rkworlds on: 1/10/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

SUBSTRING : Returns part of a given string.

SUBSTRING function retrieves a portion of the given string starting at the specified character(startindex) to the number of characters specified(length).

Syntax: SUBSTRING (string,startindex,length)
SELECT SUBSTRING('STRING FUNCTION', 1, 6) Result : STRING
SELECT SUBSTRING('STRING FUNCTION', 8, 8) Result : FUNCTION



If this helps you .
Please "Mark as Answer"

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/21/2012 [Member] Starter | Points: 25

Up
0
Down
CREATE TABLE CTEST(CID INT IDENTITY(1,1),CLSNAME VARCHAR(90))



INSERT INTO CTEST VALUES('TESSTUSER')

SELECT * FROM CTEST

SELECT SUBSTRING(CLSNAME,1,4) FROM CTEST


REGARDS

sriram

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/21/2012 [Member] Bronze | Points: 25

Up
0
Down
SUBSTRING


Substring returns the part of the string from a given characterexpression. The general syntax of Substring is as follows :

SUBSTRING(expression, start, length)

Here the function gets the string from start to length. Let us take an example below:

Collapse | Copy Code
SELECT OUT = SUBSTRING('abcdefgh', 2, 3)
The output will be "bcd".

Self-innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/21/2012 [Member] Bronze | Points: 25

Login to post response