это мой метод asp.netSQL пользователь, чтобы получить такое же значение
public static DataSet ProgressReport(int FirmID)
{
if (HttpContext.Current.Session["CNYearID"] != null && HttpContext.Current.Session["CNYearID"].ToString() != "")
{
firmcomplianceyear = Convert.ToInt32(HttpContext.Current.Session["CNYearID"]);
}
else if (HttpContext.Current.Session["CurrentFCY"] != null && HttpContext.Current.Session["CurrentFCY"].ToString() != "")
{
firmcomplianceyear = Convert.ToInt32(HttpContext.Current.Session["CurrentFCY"]);
}
if (HttpContext.Current.Session["NewCompYID"] != null && HttpContext.Current.Session["NewCompYID"].ToString() != "")
{
compliance_year = Convert.ToInt32(HttpContext.Current.Session["NewCompYID"]);
}
else if (HttpContext.Current.Session["CompYearID"] != null && HttpContext.Current.Session["CompYearID"].ToString() != "")
{
compliance_year = Convert.ToInt32(HttpContext.Current.Session["CompYearID"]);
}
String str = String.Format(@"select
F.firmname,
fr.firmusername as FirmUserName,
S.sectionnumber,
d.deptname as Department,
CONVERT(VARCHAR(10),R.InsertDate, 101) AS Date,
st.statusname,
Convert(decimal(10,2),(st.StatusPercentComplete/cast (100 as float))) as Percentage,
case when R.PolicyConfirmation = '0' then 'NO'
when R.PolicyConfirmation = '1' then 'YES'
end as PolicyConfirmation,
case when R.GeneralConfirmation='0' then 'NO'
when R.GeneralConfirmation='1' then 'YES' end as GeneralConfirmation,
comments = dbo.udfGetCommentListRajendra(r.firmcompliancerequirementid),
documents = dbo.udfGetDocumentList(F.firmid,S.sectionid),
--------- здесь им с помощью ниже UDF функции, где им stucked ----
Location=dbo.udfGetLocationList_1(F.firmid,S.sectionid,fr.firmuserid)
from requirementcertification r
join firm f on F.firmid=R.firmid
join Section s on S.sectionid= R.sectionid
join FirmComplianceRequirement fcr on Fcr.FirmComplianceRequirementID = R.FirmComplianceRequirementID
Join FirmComplianceYear FCY on FCY.FirmComplianceYearID=FCR.firmcomplianceyearid
join Department d on d.deptid=fcr.assignedto
join [Status] St on st.statusID = R.statusid
join firmuser fr on fr.firmuserid = r.userid
where r.userid in(select firmuserid from firmfirmusermapping where firmid='{0}') AND (D.FirmID=0 OR D.FirmID= '{0}') AND D.IsActive=1 AND D.IsDelete=0 And FCY.ComplianceYearID='{1}'
order by R.insertdate desc", FirmID, compliance_year);
DataSet ds = DAL.SelectRecords(str.ToString());
return ds;
}
.
USE [Mydata]
GO
Create function [dbo].[udfGetCommentList]
(
@firmcompliancerequirementid int
)
RETURNS varchar(max)
as
BEGIN
DECLARE @listStr VARCHAR(MAX)
--SELECT @listStr = COALESCE(@listStr+',' ,'') + requirementcomment
--FROM requirementcomment
--where firmcompliancerequirementid = @firmcompliancerequirementid
Select distinct @listStr= RequirementComment from requirementcomment
where [email protected]
order by RequirementCommentID desc
return @listStr
END
GO
Выходной сигнал этого:
Name Section# Department Date Status % Comments
vishalVVVV 23.503 Compliance 04/28/2015 Pending Documentation 25% Rejection comment for the second time
vishalVVVV 23.503 Finance 04/28/2015 Pending Documentation 25% one more comment on 2nd requirement
я хочу то же значение столбца комментарии во второй строке также ... но им получить предыдущее значение
мне нужно
Комментарии
Отторжение комментарий во второй раз
Отторжение комментарий во второй раз
им получать :(
отклоняющий комментарий во второй раз
еще один комментарий по 2 требованию
Вывод 'that' can not be resultset –
, пожалуйста, дайте нам образцы данных inteh-таблиц и запрос sql, который вы используете для вызова udf. – HLGEM
yesah true ... эта функция использовалась в asp, net method, который извлекал вышеуказанный результат. Я просто хочу узнать, можно ли скопировать комментарий no.1 в no2 row ??? в колонке комментариев – user3367558