Showing posts with label executing. Show all posts
Showing posts with label executing. Show all posts

Monday, March 12, 2012

Force a SPROC to run non-concurrently

Hi,
I have a sproc that needs to run, the only thing is, I only want it to =
always be executing non-concurrently, i.e., this sproc should never be =
running more that one time at any given time. (This sproc is making =
external calls which will break if ran concurrently). Does anyone have =
any ideas about how to accomplish this?
--Michael"Raterus" <raterus@.hotmail.com> wrote in message
news:%237KrGFbRFHA.3288@.TK2MSFTNGP14.phx.gbl...
Hi,

> I have a sproc that needs to run, the only thing is,
> I only want it to always be executing non-concurrently,
> i.e., this sproc should never be running more that one
> time at any given time. (This sproc is making external
> calls which will break if ran concurrently). Does anyone
> have any ideas about how to accomplish this?
Write a row to a table to say "Proc running." If there's an entry in the
table when the proc starts, return an error.
Steve|||> Write a row to a table to say "Proc running." If there's an entry in the
> table when the proc starts, return an error.
And make sure the proc resets the value, and also that you handle the case
when the proc aborts--else a failure will prevent the proc from ever running
again until you manually reset the flag (which may in fact be a requirement,
e.g. don't let it run again until we fix whatever made it fail).
A|||I've actually explored that idea, I'd write "Proc running" when it =
starts and "All Done" when it finishes. My only worries is that the =
sproc ever fails it would never write "All Done", which will backlog my =
process, and cause a ton of problems. Any way to guarantee that the =
proc will write "All Done" at the end, no matter what happens in the =
procedure?
"Steve" <steve@.somewhere.invalid.com> wrote in message =
news:Vjt9e.4937749$Zm5.767709@.news.easynews.com...
> "Raterus" <raterus@.hotmail.com> wrote in message
> news:%237KrGFbRFHA.3288@.TK2MSFTNGP14.phx.gbl...
> Hi,
>=20
>=20
> Write a row to a table to say "Proc running." If there's an entry in =
the
> table when the proc starts, return an error.
>=20
> --=20
> Steve
>=20
>|||You an use an application lock in your stored procedure. See sp_getapplock
in Books Online for the details. It has a couple of advantages, like
settings lock time-out periods, so the second instance of the stored
procedure can wait for the first instance to finish within a certain time
instead of just plain failing.
Jacco Schalkwijk
SQL Server MVP
"Raterus" <raterus@.hotmail.com> wrote in message
news:%237KrGFbRFHA.3288@.TK2MSFTNGP14.phx.gbl...
Hi,
I have a sproc that needs to run, the only thing is, I only want it to
always be executing non-concurrently, i.e., this sproc should never be
running more that one time at any given time. (This sproc is making external
calls which will break if ran concurrently). Does anyone have any ideas
about how to accomplish this?
--Michael

Friday, March 9, 2012

for xml explicit data problem

Hi
I am running the following stored proc by executing a data set in c#.
surprisigly I am getting data padded with extra characters.
something like this - \"christy john"\. How to get rid of '\' this
character.
i try search and replace with regexp as well as string replace
functions without luck.
Here is the actual xml look like when I read from data set in c#.
<TREENODES><treenode text=\"A/L ALLANDOO, FELIX\"/><treenode
text=\"BEDI, RAHUL\"/><treenode text=\"CHALMERS, WILLIAM\"><treenode
text=\"CNOSSEN, RICK\"><treenode text=\"ANKALA, PRAVEEN\"/><treenode
text=\"BOGIA, DOUGLAS\"/><treenode text=\"COOK, HAROLD\"/><treenode
text=\"DAILY, STEPHEN\"/><treenode text=\"GAN, XIAOCHUN\"/><treenode
text=\"GARCEAU, PAUL\"/><treenode text=\"GOTTHARDT,
STEVEN\"/><treenode text=\"GUPTA, MEENAKSHI\"/></TREENODES>
Query analyser data in SQL SERVER looks perfectly alright without
special
character padding like shown beow.
<TREENODES><treenode text="A/L ALLANDOO, FELIX"/><treenode text="BEDI,
RAHUL"/><treenode text="CHALMERS, WILLIAM"><treenode text="CNOSSEN,
RICK"><treenode text="ANKALA, PRAVEEN"/><treenode text="BOGIA,
DOUGLAS"/><treenode text="COOK, HAROLD"/><treenode tex
Please help me.
Rao
-- Here is c# code --
ds = SqlHelper.ExecuteDataset(ConfigurationSettings.App Settings[ASPNET.StarterKit.TimeTracker.Web.Global. CfgKeyConnString],
SPname);
System.IO.StringWriter strWriter = new StringWriter();
ds.WriteXml(strWriter);
strXML = strWriter.ToString();
--Here is stored procedure and c# code--
dbo.ResourceXMLTest
as
set nocount on
--Take out the next block and make this SP accept
--a variable table like it does for @.EmpToMan
SET CONCAT_NULL_YIELDS_NULL OFF
Declare @.EmpToMan table(
ResourceID int,
ManagerID int,
Depth int,
Lineage nvarchar(256),
ResourceWWID numeric(19),
RFirstName nvarchar(50),
RLastName nvarchar(50)
)
INSERT INTO @.EmpToMan
SELECT
E.EmployeeID,
E.ManagerID,
E.Depth,
E.Lineage,
R.WWID,
R.FirstName ,
R.LastName + ', ' + R.FirstName
--R.LastName + ', ' + R.FirstName
FROM
Resources R left outer join EmployeeToManager E
ON r.resourceID = E.EmployeeID
select
1 as Tag,
0 as Parent,
null as [TREENODES!1!text],
null as [treenode!2!text],
null as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
union all
select
2 as Tag,
1 as Parent,
null,
RLastName as [treenode!2!text],
null as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
from
@.EmpToMan
where
Depth + 1 = 1
union
all
select
3 as Tag,
2 as Parent,
null,
t1.RLastName,
t2.RLastName as [treenode!3!text],
null as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
from
@.EmpToMan as t1
inner join
@.EmpToMan as t2
on
t1.ResourceID = t2.ManagerID
where
t1.depth + 1 = 1
and
t2.depth + 1 = 2
union
all
--Begin Block #4
select
4 as Tag,
3 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
null as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From
@.EmpToMan as t1
inner join
@.EmpToMan as t2
on
t1.ResourceID = t2.ManagerID
inner join
@.EmpToMan as t3
on
t2.ResourceID = t3.ManagerID
where
t1.depth +1 = 1
and
t2.depth + 1 = 2
and
t3.depth + 1 = 3
--End Block
union all
--Begin Block #5
select
5 as Tag,
4 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
null as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
--End Block
union all
--Begin Block #6
select
6 as Tag,
5 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
null as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
--End Block
union all
--Begin Block #7
select
7 as Tag,
6 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
null as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
--End Block
union all
--Begin Block #8
select
8 as Tag,
7 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
null as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
--End Block
union all
--Begin Block #9
select
9 as Tag,
8 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
null as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
--End Block
union all
--Begin Block #10
select
10 as Tag,
9 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
null as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
--End Block
union all
--Begin Block #11
select
11 as Tag,
10 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
null as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
--End Block
union all
--Begin Block #12
select
12 as Tag,
11 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
t11.RLastName as [treenode!12!text],
null as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
inner join @.EmpToMan as t11
on t10.ResourceID = t11.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
and t11.depth + 1 = 11
--End Block
union all
--Begin Block #13
select
13 as Tag,
12 as Parent,
null,
t1.RLastName,
t2.RLastName,
t3.RLastName as [treenode!4!text],
t4.RLastName as [treenode!5!text],
t5.RLastName as [treenode!6!text],
t6.RLastName as [treenode!7!text],
t7.RLastName as [treenode!8!text],
t8.RLastName as [treenode!9!text],
t9.RLastName as [treenode!10!text],
t10.RLastName as [treenode!11!text],
t11.RLastName as [treenode!12!text],
t12.RLastName as [treenode!13!text]
From @.EmpToMan as t1
inner join@.EmpToMan as t2
on t1.ResourceID = t2.ManagerID
inner join @.EmpToMan as t3
on t2.ResourceID = t3.ManagerID
inner join @.EmpToMan as t4
on t3.ResourceID = t4.ManagerID
inner join @.EmpToMan as t5
on t4.ResourceID = t5.ManagerID
inner join @.EmpToMan as t6
on t5.ResourceID = t6.ManagerID
inner join @.EmpToMan as t7
on t6.ResourceID = t7.ManagerID
inner join @.EmpToMan as t8
on t7.ResourceID = t8.ManagerID
inner join @.EmpToMan as t9
on t8.ResourceID = t9.ManagerID
inner join @.EmpToMan as t10
on t9.ResourceID = t10.ManagerID
inner join @.EmpToMan as t11
on t10.ResourceID = t11.ManagerID
inner join @.EmpToMan as t12
on t11.ResourceID = t12.ManagerID
where t1.depth +1 = 1
andt2.depth + 1 = 2
and t3.depth + 1 = 3
and t4.depth + 1 = 4
and t5.depth + 1 = 5
and t6.depth + 1 = 6
and t7.depth + 1 = 7
and t8.depth + 1 = 8
and t9.depth + 1 = 9
and t10.depth + 1 = 10
and t11.depth + 1 = 11
and t12.depth + 1 = 12
--End Block
order by
[TREENODES!1!text],
[treenode!2!text],
[treenode!3!text],
[treenode!4!text],
[treenode!5!text],
[treenode!6!text],
[treenode!7!text],
[treenode!8!text],
[treenode!9!text],
[treenode!10!text],
[treenode!11!text],
[treenode!12!text],
[treenode!13!text]
for xml explicit
This looks like a C# issue. Are you sure that the \ is actually part of the
data? It could be that you see \" as a way to escape the " for some C#
specific reason and that the data still only contains ". You may want to
check in a C# specific newsgroup if that does not explain it.
HTH
Michael
"rao" <jayamallik@.hotmail.com> wrote in message
news:f2ff1cc.0408251644.2bf22b62@.posting.google.co m...
> Hi
> I am running the following stored proc by executing a data set in c#.
> surprisigly I am getting data padded with extra characters.
> something like this - \"christy john"\. How to get rid of '\' this
> character.
> i try search and replace with regexp as well as string replace
> functions without luck.
>
> Here is the actual xml look like when I read from data set in c#.
> <TREENODES><treenode text=\"A/L ALLANDOO, FELIX\"/><treenode
> text=\"BEDI, RAHUL\"/><treenode text=\"CHALMERS, WILLIAM\"><treenode
> text=\"CNOSSEN, RICK\"><treenode text=\"ANKALA, PRAVEEN\"/><treenode
> text=\"BOGIA, DOUGLAS\"/><treenode text=\"COOK, HAROLD\"/><treenode
> text=\"DAILY, STEPHEN\"/><treenode text=\"GAN, XIAOCHUN\"/><treenode
> text=\"GARCEAU, PAUL\"/><treenode text=\"GOTTHARDT,
> STEVEN\"/><treenode text=\"GUPTA, MEENAKSHI\"/></TREENODES>
>
> Query analyser data in SQL SERVER looks perfectly alright without
> special
> character padding like shown beow.
> <TREENODES><treenode text="A/L ALLANDOO, FELIX"/><treenode text="BEDI,
> RAHUL"/><treenode text="CHALMERS, WILLIAM"><treenode text="CNOSSEN,
> RICK"><treenode text="ANKALA, PRAVEEN"/><treenode text="BOGIA,
> DOUGLAS"/><treenode text="COOK, HAROLD"/><treenode tex
> Please help me.
> Rao
>
> -- Here is c# code --
> ds =
> SqlHelper.ExecuteDataset(ConfigurationSettings.App Settings[ASPNET.StarterKit.TimeTracker.Web.Global. CfgKeyConnString],
> SPname);
> System.IO.StringWriter strWriter = new StringWriter();
> ds.WriteXml(strWriter);
> strXML = strWriter.ToString();
> --Here is stored procedure and c# code--
> dbo.ResourceXMLTest
> as
> set nocount on
> --Take out the next block and make this SP accept
> --a variable table like it does for @.EmpToMan
> SET CONCAT_NULL_YIELDS_NULL OFF
> Declare @.EmpToMan table(
> ResourceID int,
> ManagerID int,
> Depth int,
> Lineage nvarchar(256),
> ResourceWWID numeric(19),
> RFirstName nvarchar(50),
> RLastName nvarchar(50)
> )
> INSERT INTO @.EmpToMan
> SELECT
> E.EmployeeID,
> E.ManagerID,
> E.Depth,
> E.Lineage,
> R.WWID,
> R.FirstName ,
> R.LastName + ', ' + R.FirstName
> --R.LastName + ', ' + R.FirstName
> FROM
> Resources R left outer join EmployeeToManager E
> ON r.resourceID = E.EmployeeID
> select
> 1 as Tag,
> 0 as Parent,
> null as [TREENODES!1!text],
> null as [treenode!2!text],
> null as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> union all
> select
> 2 as Tag,
> 1 as Parent,
> null,
> RLastName as [treenode!2!text],
> null as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> from
> @.EmpToMan
> where
> Depth + 1 = 1
> union
> all
> select
> 3 as Tag,
> 2 as Parent,
> null,
> t1.RLastName,
> t2.RLastName as [treenode!3!text],
> null as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> from
> @.EmpToMan as t1
> inner join
> @.EmpToMan as t2
> on
> t1.ResourceID = t2.ManagerID
> where
> t1.depth + 1 = 1
> and
> t2.depth + 1 = 2
> union
> all
> --Begin Block #4
> select
> 4 as Tag,
> 3 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> null as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From
> @.EmpToMan as t1
> inner join
> @.EmpToMan as t2
> on
> t1.ResourceID = t2.ManagerID
> inner join
> @.EmpToMan as t3
> on
> t2.ResourceID = t3.ManagerID
> where
> t1.depth +1 = 1
> and
> t2.depth + 1 = 2
> and
> t3.depth + 1 = 3
> --End Block
> union all
> --Begin Block #5
> select
> 5 as Tag,
> 4 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> null as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> --End Block
> union all
> --Begin Block #6
> select
> 6 as Tag,
> 5 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> null as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> --End Block
> union all
> --Begin Block #7
> select
> 7 as Tag,
> 6 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> null as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> --End Block
> union all
> --Begin Block #8
> select
> 8 as Tag,
> 7 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> null as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> --End Block
> union all
> --Begin Block #9
> select
> 9 as Tag,
> 8 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> null as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> --End Block
> union all
>
> --Begin Block #10
> select
> 10 as Tag,
> 9 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> null as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> --End Block
> union all
> --Begin Block #11
> select
> 11 as Tag,
> 10 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> null as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> --End Block
> union all
> --Begin Block #12
> select
> 12 as Tag,
> 11 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> t11.RLastName as [treenode!12!text],
> null as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> inner join @.EmpToMan as t11
> on t10.ResourceID = t11.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> and t11.depth + 1 = 11
> --End Block
> union all
> --Begin Block #13
> select
> 13 as Tag,
> 12 as Parent,
> null,
> t1.RLastName,
> t2.RLastName,
> t3.RLastName as [treenode!4!text],
> t4.RLastName as [treenode!5!text],
> t5.RLastName as [treenode!6!text],
> t6.RLastName as [treenode!7!text],
> t7.RLastName as [treenode!8!text],
> t8.RLastName as [treenode!9!text],
> t9.RLastName as [treenode!10!text],
> t10.RLastName as [treenode!11!text],
> t11.RLastName as [treenode!12!text],
> t12.RLastName as [treenode!13!text]
> From @.EmpToMan as t1
> inner join @.EmpToMan as t2
> on t1.ResourceID = t2.ManagerID
> inner join @.EmpToMan as t3
> on t2.ResourceID = t3.ManagerID
> inner join @.EmpToMan as t4
> on t3.ResourceID = t4.ManagerID
> inner join @.EmpToMan as t5
> on t4.ResourceID = t5.ManagerID
> inner join @.EmpToMan as t6
> on t5.ResourceID = t6.ManagerID
> inner join @.EmpToMan as t7
> on t6.ResourceID = t7.ManagerID
> inner join @.EmpToMan as t8
> on t7.ResourceID = t8.ManagerID
> inner join @.EmpToMan as t9
> on t8.ResourceID = t9.ManagerID
> inner join @.EmpToMan as t10
> on t9.ResourceID = t10.ManagerID
> inner join @.EmpToMan as t11
> on t10.ResourceID = t11.ManagerID
> inner join @.EmpToMan as t12
> on t11.ResourceID = t12.ManagerID
> where t1.depth +1 = 1
> and t2.depth + 1 = 2
> and t3.depth + 1 = 3
> and t4.depth + 1 = 4
> and t5.depth + 1 = 5
> and t6.depth + 1 = 6
> and t7.depth + 1 = 7
> and t8.depth + 1 = 8
> and t9.depth + 1 = 9
> and t10.depth + 1 = 10
> and t11.depth + 1 = 11
> and t12.depth + 1 = 12
> --End Block
> order by
> [TREENODES!1!text],
> [treenode!2!text],
> [treenode!3!text],
> [treenode!4!text],
> [treenode!5!text],
> [treenode!6!text],
> [treenode!7!text],
> [treenode!8!text],
> [treenode!9!text],
> [treenode!10!text],
> [treenode!11!text],
> [treenode!12!text],
> [treenode!13!text]
> for xml explicit
|||Hi Michael,
Yes it is esacape character actually shown like this "\" as part of
data,
The ascii value of it is 34. In the debugger it shows as '"'. I need
to find out how to replace '"'with " double quotes.
I was able to replace with single quotes and empty strings. I am
getting
syntax errors while replacing with double quote.
for example tempstr=Regex.Replace(tempstr,Convert.ToString('"' ),"")
would produce the result some thing like this - text=A/L ALLANDOO,
FELIX\
But I need the result as look like this - text="A/L ALLANDOO, FELIX"\
Looking for some help.
Thanks
Rao
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message news:<#HUyLPyiEHA.2140@.TK2MSFTNGP15.phx.gbl>...[vbcol=seagreen]
> This looks like a C# issue. Are you sure that the \ is actually part of the
> data? It could be that you see \" as a way to escape the " for some C#
> specific reason and that the data still only contains ". You may want to
> check in a C# specific newsgroup if that does not explain it.
> HTH
> Michael
> "rao" <jayamallik@.hotmail.com> wrote in message
> news:f2ff1cc.0408251644.2bf22b62@.posting.google.co m...

Friday, February 24, 2012

For Loop container - out of memory condition

Just upgraded to the June CTP and having problems executing packages that loop using a For Loop. The first pass is fine but when trying the second we get:

Error: 0xC0208296 at LeaseFact Update, Sort 2 [5197]: The input buffer could not be cloned. An out-of-memory condition occurred or there was an internal error.

Error: 0xC0047022 at (name of data flow), DTS.Pipeline: The ProcessInput method on component "Sort 2" (5197) failed with error code 0x80004005. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

Anyone seen this kind of problem ?

Thanks

Known issue, see other post I did WRT this issue please.