Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
nuruddean
Starting Member
11 Posts |
Posted - 2011-07-15 : 06:45:59
|
field grade contain II.DG.52.P2how I want to get DG52?to get 52 only I used:regexp_substr(Grade_Name,'[^.]+',1,3)but I dont know how to get DG52, Please help meMy Name is Nuruddin |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-07-15 : 07:30:38
|
I am not familiar with regexp_substr function. Are you using Microsoft SQL Server, or some other DBMS? If you are on SQL Server, you can use PARSENAME function to do this:DECLARE @var VARCHAR(32); SET @VAR = 'II.DG.52.P2';SELECT PARSENAME(@var,3)+PARSENAME(@var,2); Parsename is a function whose primary purpose is to parse the four-part names of database objects, but people use it for parsing tokens sometimes. |
|
|
nuruddean
Starting Member
11 Posts |
Posted - 2011-07-20 : 04:16:55
|
quote: Originally posted by sunitabeck I am not familiar with regexp_substr function. Are you using Microsoft SQL Server, or some other DBMS? If you are on SQL Server, you can use PARSENAME function to do this:DECLARE @var VARCHAR(32); SET @VAR = 'II.DG.52.P2';SELECT PARSENAME(@var,3)+PARSENAME(@var,2); Parsename is a function whose primary purpose is to parse the four-part names of database objects, but people use it for parsing tokens sometimes.
thank you a lotsMy Name is Nuruddin |
|
|
|
|
|
|
|