November 11, 2009 at 1:29 am
Dear friends;
Hai to every one...................... pls help this
The Table like that o/p
Facultyid
FA885A0/FA094V0
FA885A0/FA094V0
FA885A0/FA094V0
FA885A0/FA094V0
FA885A0/FA094V0
FA885A0/FA094V0
FA885A0/FA094V0
How can i split that faculty id in '/' or any one symbol postion;
Thse Splitting values are stored in table
The table like Id Fuid1,Fuid2
Like that........
Fuid1 Fuid2
FA885A0 FA094V0
Thanks & Advance;
A.Faijurrahuman
November 11, 2009 at 1:33 am
Use "Left","Right" and "Charindex"
See BOL for a full description of their use
November 11, 2009 at 1:38 am
Here is one way of doing it:
declare @string varchar(20)
set @string = 'FA885A0/FA094V0'
select left(@string, charindex('/',@string)-1) as FirstPart,
right(@string, len(@string) - charindex('/',@string)) as SecondPart
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
November 11, 2009 at 1:50 am
Slightly confused here, could you explain your problem a little more? It may help to have the DDL for the table involved plus any code you have already attempted to write to solve thins problem.
November 11, 2009 at 2:39 am
Here is other way of doing it
DECLARE @WORD VARCHAR(50)
SET @WORD = 'FA885A0/FA094V0'
SELECT SUBSTRING(@WORD,1,CHARINDEX('/',@WORD)-1) FirstPartofString, SUBSTRING(@WORD,CHARINDEX('/',@WORD)+1,LEN(@WORD)) SecondPartofString
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply