Posts

Showing posts from May, 2010

String Function in SQL-Substring,Reverse,CharIndex

Suppose You have String "~/ABC/PQR.xxx" in your tables Now u Want to string PQR.xxx fromm above string So For That Follow the Steps 1) Open NewQuery Window 2) Paste following Code declare @str as varchar(200),@str1 as varchar(200),@rev as varchar(200) set @str ='~/ABC/PQR.xxx' select @rev = reverse(@str) SELECT @str1 = CHARINDEX('/', reverse(@str)) select @str1,@rev'@rev',reverse(substring(@rev,0,convert(int,@str1))) 3) Execute the Code 4) You will get the Output Like that PQR.xxx