Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
SQL CharIndex Example
WhatsApp
Ashish Srivastava
Mar 30
2016
979
0
0
SQL CHARINDEX example:
DECLARE
@PW_MPID NVARCHAR(
max
)
set
@PW_MPID=
'1555|2555|35|'
DECLARE
@PW_MPIDPostion
Varchar
(
max
) = CHARINDEX(
'|'
,@PW_MPID)
rint @PW_MPIDPostion
DECLARE
@TempPW_MPID
Varchar
(
max
)
WHILE(@PW_MPIDPostion > 0)
BEGIN
SET
@TempPW_MPID =
SUBSTRING
(@PW_MPID ,1,@PW_MPIDPostion-1)
print @TempPW_MPID
SET
@PW_MPID =
SUBSTRING
(@PW_MPID,@PW_MPIDPostion +1,LEN(@PW_MPID))
print @PW_MPID
SET
@PW_MPIDPostion = CHARINDEX(
'|'
,@PW_MPID)
print @PW_MPIDPostion
END
CHARINDEX
sql
Up Next
SQL CharIndex Example