April 20, 2010 at 7:55 am
Hi,
how i can extract only the processes name,and on another column the cpu usage resutls from this table.
THX
create table tbl_processes (proc_nammme nvarchar (500))
go
insert into tbl_processes values ('ProcessName:SqlWb |CpuUsage:5')
insert into tbl_processes values ('ProcessName:CPU Burn-in |CpuUsage:99')
insert into tbl_processes values ('ProcessName:cscript |CpuUsage:8')
April 20, 2010 at 8:08 am
Hope this helps:
create table dbo.tbl_processes (proc_nammme nvarchar (500))
go
insert into dbo.tbl_processes values ('ProcessName:SqlWb |CpuUsage:5')
insert into dbo.tbl_processes values ('ProcessName:CPU Burn-in |CpuUsage:99')
insert into dbo.tbl_processes values ('ProcessName:cscript |CpuUsage:8')
go
select
*,
len('ProcessName:'),charindex('|', proc_nammme),len('CpuUsage:'),
substring(proc_nammme, charindex('ProcessName:', proc_nammme) + 12, charindex('|', proc_nammme) - 13),
substring(proc_nammme, charindex('CpuUsage:', proc_nammme) + 9, len(proc_nammme) - charindex('CpuUsage:', proc_nammme) + 9)
from
dbo.tbl_processes;
go
April 20, 2010 at 8:40 am
thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply