日期:2014-05-18 浏览次数:20512 次
declare @s varchar(max) set @s='reurl=index.aspx&visitedforums=2;+User_Cookie=UserName=admin&UserPwd=admin;+ASP.NET_SessionId=jph5hebcqk3piitv3vkxj1xg' select right(PARSENAME(replace(replace(@s,'.','@'),';','.'),2),CHARINDEX(@s,'=')-1)
------解决方案--------------------
if object_id('[test1]') is not null drop table [test1] go create table [test1]([id] int,[zhang] varchar(92)) insert [test1] select 1,'eurl=index.aspx&visitedforums=2;+User_Cookie=UserName=admin&UserPwd=admin;+ASP.NET_SessionId' go select username=left(stuff(zhang,1,charindex('UserName=',zhang)+8,''),charindex('&',stuff(zhang,1,charindex('UserName=',zhang)+8,''))-1) from test1 /** username ----------------------------------- admin (1 行受影响) **/