---
title: "sqlserver indexOf   lastIndexOf"
author: "ch_dj"
date: "2015-01-13T13:53:31Z"
tags: []
categories: ["数据库"]
slug: "sqlserver-indexof-lastindexof"
draft: false
lastmod: "2015-01-13T13:53:31Z"
id: 2175444
url: "https://ch-dj.iteye.com/blog/2175444"
---

//sqlserver  lastIndexOf
 select  len(c_attachFilePath)+1-charindex('/',reverse(c_attachFilePath)) from .dbo.HDZX_QUESTION
   where  is not null


//sqlserver indexOf 
  select CHARINDEX('.',c_attachFilePath) from .dbo.HDZX_QUESTION where  is not null