ALTER PROCEDURE [dbo].[GetCheckoutCheckedFile](@filenameurl as varchar(100),@Acls as nvarchar(50),@itemid as varchar(1000))
AS
declare @site as varchar(50)
set @site=@Acls
declare @t1 table
(
t1 int
)
declare
@ParsedList table
(
OrderID int
)
BEGIN
DECLARE @OrderID varchar(10), @Pos int
SET @itemid = LTRIM(RTRIM(@itemid))+ ','
SET @Pos = CHARINDEX(',', @itemid, 1)
IF REPLACE(@itemid, ',', '') <> ''
BEGIN
WHILE @Pos > 0
BEGIN
SET @OrderID = LTRIM(RTRIM(LEFT(@itemid, @Pos - 1)))
IF @OrderID <> ''
BEGIN
INSERT INTO @ParsedList (OrderID)
VALUES (CAST(@OrderID AS int)) --Use Appropriate conversion
END
SET @itemid = RIGHT(@itemid, LEN(@itemid) - @Pos)
SET @Pos = CHARINDEX(',', @itemid, 1)
END
/*select * from @ParsedList*/
/*select * from checkinoutdetails where itemid in(select * from @ParsedList)*/
END
END
while charindex(',',@site) > 0
begin
insert into @t1 select substring(@site,1,(charindex(',',@site)-1))
SET @site = substring(@site,charindex(',',@site)+1,len(@site))
end
insert into @t1
select @site
if 1=(select top 1 * from @t1)
select * from documents a,checkinoutdetails b where a.itemid=b.itemid and filenameurl=@filenameurl and b.itemid in (select * from @ParsedList)
else
select * from documents a,checkinoutdetails b where a.itemid=b.itemid and filenameurl=@filenameurl and (Acls in(select * from @t1)) and acls !='1' and b.itemid in (select * from @ParsedList)
create PROCEDURE [dbo].[GetMyCheckoutCheckedFileByItemIds]
(
@itemid as varchar(1000),
@username as varchar(100)
)
AS
declare @ids as varchar(200)
set @ids=@itemid
declare @t1 table
(
t1 int
)
while charindex(',',@ids) > 0
begin
insert into @t1 select substring(@ids,1,(charindex(',',@ids)-1))
SET @ids = substring(@ids,charindex(',',@ids)+1,len(@ids))
end
insert into @t1
select @ids
select * from documents a,checkinoutdetails b where a.itemid in
(select * from @t1 ) and b.itemid in
(select * from @t1 ) and b.emailid=@username and a.createdbyuser=@username
AS
declare @site as varchar(50)
set @site=@Acls
declare @t1 table
(
t1 int
)
declare
@ParsedList table
(
OrderID int
)
BEGIN
DECLARE @OrderID varchar(10), @Pos int
SET @itemid = LTRIM(RTRIM(@itemid))+ ','
SET @Pos = CHARINDEX(',', @itemid, 1)
IF REPLACE(@itemid, ',', '') <> ''
BEGIN
WHILE @Pos > 0
BEGIN
SET @OrderID = LTRIM(RTRIM(LEFT(@itemid, @Pos - 1)))
IF @OrderID <> ''
BEGIN
INSERT INTO @ParsedList (OrderID)
VALUES (CAST(@OrderID AS int)) --Use Appropriate conversion
END
SET @itemid = RIGHT(@itemid, LEN(@itemid) - @Pos)
SET @Pos = CHARINDEX(',', @itemid, 1)
END
/*select * from @ParsedList*/
/*select * from checkinoutdetails where itemid in(select * from @ParsedList)*/
END
END
while charindex(',',@site) > 0
begin
insert into @t1 select substring(@site,1,(charindex(',',@site)-1))
SET @site = substring(@site,charindex(',',@site)+1,len(@site))
end
insert into @t1
select @site
if 1=(select top 1 * from @t1)
select * from documents a,checkinoutdetails b where a.itemid=b.itemid and filenameurl=@filenameurl and b.itemid in (select * from @ParsedList)
else
select * from documents a,checkinoutdetails b where a.itemid=b.itemid and filenameurl=@filenameurl and (Acls in(select * from @t1)) and acls !='1' and b.itemid in (select * from @ParsedList)
create PROCEDURE [dbo].[GetMyCheckoutCheckedFileByItemIds]
(
@itemid as varchar(1000),
@username as varchar(100)
)
AS
declare @ids as varchar(200)
set @ids=@itemid
declare @t1 table
(
t1 int
)
while charindex(',',@ids) > 0
begin
insert into @t1 select substring(@ids,1,(charindex(',',@ids)-1))
SET @ids = substring(@ids,charindex(',',@ids)+1,len(@ids))
end
insert into @t1
select @ids
select * from documents a,checkinoutdetails b where a.itemid in
(select * from @t1 ) and b.itemid in
(select * from @t1 ) and b.emailid=@username and a.createdbyuser=@username