I have to generate an XMl from a SQL Server 2000 table. Using the clause FOR
XML i can only send the result to screen or to file.
I want, instead, store the result, into a field column in another table.
There's a way i can do it without passing through a file (and OpenXML), but
storing the result directly into the field column?
tnks in advance
andrea
Do you want to say something along the line of
insert into T(xmlcol) values (select ... for xml ...)
?
If so, you will need to wait for SQL Server 2005. In SQL Server 2000, you
had to do some really ugly workarounds by moving the XML to the client and
then reload it back into the server.
Best regards
Michael
"vikys" <vikys@.hotmail.com> wrote in message
news:utcDmwwcFHA.3712@.TK2MSFTNGP09.phx.gbl...
>I have to generate an XMl from a SQL Server 2000 table. Using the clause
>FOR
> XML i can only send the result to screen or to file.
> I want, instead, store the result, into a field column in another table.
> There's a way i can do it without passing through a file (and OpenXML),
> but
> storing the result directly into the field column?
> tnks in advance
> andrea
>
Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts
Thursday, March 29, 2012
Monday, March 26, 2012
how much memory does a transaction take?
hello,
i found out that it is useful while testing queries in my company to
start with begin tran, to do a restore if i might forget the where
clause
in an update on day after a long night.
but what does that cost?
the changes i make are only in my scope, to the server seems
to create temp tables of all tables i use.
if i do queryes for example 30 minutes without commit,
how does that affect the server? is that a very bad practice
or is that a normal way of working on a live server?
we do not really have testing systems, so that ist my
problem here..
nice to have some opinions stated here,
thank you and happy new year,
mike> if i do queryes for example 30 minutes without commit,
> how does that affect the server? is that a very bad practice
> or is that a normal way of working on a live server?
It's very bad if your users have to wait 30 min till transaction will be
commited.It should be avoided
http://www.sql-server-performance.com/blocking.asp
<peppi911@.hotmail.com> wrote in message
news:1136460584.490204.3350@.g44g2000cwa.googlegroups.com...
> hello,
>
> i found out that it is useful while testing queries in my company to
> start with begin tran, to do a restore if i might forget the where
> clause
> in an update on day after a long night.
>
> but what does that cost?
> the changes i make are only in my scope, to the server seems
> to create temp tables of all tables i use.
> if i do queryes for example 30 minutes without commit,
> how does that affect the server? is that a very bad practice
> or is that a normal way of working on a live server?
> we do not really have testing systems, so that ist my
> problem here..
> nice to have some opinions stated here,
>
> thank you and happy new year,
> mike
>|||Hi,
but if i start my work with
BEGIN TRAN
...do something 30 min.
ROLLBACK TRAN
i think all the changes i do are in my scope and the records are not
locked,
so i surmised that the server creates a copy for me or whatever, am i
wrong?
you mean
begin tran
select * from customers
and i go to lunch does mean nobody can use this table until i do
rollback?
Well i guess i need to do further investigations here,-)
Thanks, mike|||First you should read in Books Online about SET TRANSACTION ISOLATION LEVEL and also about different
lock types. Shared locks are by default not held until end of transaction. Most other lock types
are, though.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<peppi911@.hotmail.com> wrote in message
news:1136462605.759961.248740@.g43g2000cwa.googlegroups.com...
> Hi,
> but if i start my work with
> BEGIN TRAN
> ...do something 30 min.
> ROLLBACK TRAN
> i think all the changes i do are in my scope and the records are not
> locked,
> so i surmised that the server creates a copy for me or whatever, am i
> wrong?
> you mean
> begin tran
> select * from customers
> and i go to lunch does mean nobody can use this table until i do
> rollback?
> Well i guess i need to do further investigations here,-)
> Thanks, mike
>|||Read the books is the best advice.
Anyway, you can hold the shared lock got by a select until the end of a
transaction if you specify the hint (HOLDLOCK).
--
Bazili
"Tibor Karaszi" wrote:
> First you should read in Books Online about SET TRANSACTION ISOLATION LEVEL and also about different
> lock types. Shared locks are by default not held until end of transaction. Most other lock types
> are, though.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> <peppi911@.hotmail.com> wrote in message
> news:1136462605.759961.248740@.g43g2000cwa.googlegroups.com...
> > Hi,
> > but if i start my work with
> >
> > BEGIN TRAN
> > ...do something 30 min.
> > ROLLBACK TRAN
> >
> > i think all the changes i do are in my scope and the records are not
> > locked,
> > so i surmised that the server creates a copy for me or whatever, am i
> > wrong?
> > you mean
> >
> > begin tran
> > select * from customers
> > and i go to lunch does mean nobody can use this table until i do
> > rollback?
> >
> > Well i guess i need to do further investigations here,-)
> > Thanks, mike
> >
>
i found out that it is useful while testing queries in my company to
start with begin tran, to do a restore if i might forget the where
clause
in an update on day after a long night.
but what does that cost?
the changes i make are only in my scope, to the server seems
to create temp tables of all tables i use.
if i do queryes for example 30 minutes without commit,
how does that affect the server? is that a very bad practice
or is that a normal way of working on a live server?
we do not really have testing systems, so that ist my
problem here..
nice to have some opinions stated here,
thank you and happy new year,
mike> if i do queryes for example 30 minutes without commit,
> how does that affect the server? is that a very bad practice
> or is that a normal way of working on a live server?
It's very bad if your users have to wait 30 min till transaction will be
commited.It should be avoided
http://www.sql-server-performance.com/blocking.asp
<peppi911@.hotmail.com> wrote in message
news:1136460584.490204.3350@.g44g2000cwa.googlegroups.com...
> hello,
>
> i found out that it is useful while testing queries in my company to
> start with begin tran, to do a restore if i might forget the where
> clause
> in an update on day after a long night.
>
> but what does that cost?
> the changes i make are only in my scope, to the server seems
> to create temp tables of all tables i use.
> if i do queryes for example 30 minutes without commit,
> how does that affect the server? is that a very bad practice
> or is that a normal way of working on a live server?
> we do not really have testing systems, so that ist my
> problem here..
> nice to have some opinions stated here,
>
> thank you and happy new year,
> mike
>|||Hi,
but if i start my work with
BEGIN TRAN
...do something 30 min.
ROLLBACK TRAN
i think all the changes i do are in my scope and the records are not
locked,
so i surmised that the server creates a copy for me or whatever, am i
wrong?
you mean
begin tran
select * from customers
and i go to lunch does mean nobody can use this table until i do
rollback?
Well i guess i need to do further investigations here,-)
Thanks, mike|||First you should read in Books Online about SET TRANSACTION ISOLATION LEVEL and also about different
lock types. Shared locks are by default not held until end of transaction. Most other lock types
are, though.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<peppi911@.hotmail.com> wrote in message
news:1136462605.759961.248740@.g43g2000cwa.googlegroups.com...
> Hi,
> but if i start my work with
> BEGIN TRAN
> ...do something 30 min.
> ROLLBACK TRAN
> i think all the changes i do are in my scope and the records are not
> locked,
> so i surmised that the server creates a copy for me or whatever, am i
> wrong?
> you mean
> begin tran
> select * from customers
> and i go to lunch does mean nobody can use this table until i do
> rollback?
> Well i guess i need to do further investigations here,-)
> Thanks, mike
>|||Read the books is the best advice.
Anyway, you can hold the shared lock got by a select until the end of a
transaction if you specify the hint (HOLDLOCK).
--
Bazili
"Tibor Karaszi" wrote:
> First you should read in Books Online about SET TRANSACTION ISOLATION LEVEL and also about different
> lock types. Shared locks are by default not held until end of transaction. Most other lock types
> are, though.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> <peppi911@.hotmail.com> wrote in message
> news:1136462605.759961.248740@.g43g2000cwa.googlegroups.com...
> > Hi,
> > but if i start my work with
> >
> > BEGIN TRAN
> > ...do something 30 min.
> > ROLLBACK TRAN
> >
> > i think all the changes i do are in my scope and the records are not
> > locked,
> > so i surmised that the server creates a copy for me or whatever, am i
> > wrong?
> > you mean
> >
> > begin tran
> > select * from customers
> > and i go to lunch does mean nobody can use this table until i do
> > rollback?
> >
> > Well i guess i need to do further investigations here,-)
> > Thanks, mike
> >
>
Friday, March 9, 2012
How is the row filter clause and join filter should be....
Hi,
I am new to replication, I have the following tables in my
database, and I would like to replicate to other
subscriber using Merge Replication:
tblProduct (Product master)
ProdID (PK)
ProdGrp (FK to Product grouping)
ProdDesc
tblProdGrp (Product grouping)
ProdGrp (PK)
ProdGrpDesc
tblCustomer (Customer master)
CustID (PK)
BranchID (FK to branch master)
OfferGrp (FK to trade offer grouping)
CustName
tblBranch (Branch master)
BranchID (PK)
BranchName
tblTradeOfferGroup (Trade offer grouping)
OfferGrp (PK)
OfferGrpDesc
tblTradeOffer (Trade offer)
OfferID (PK)
OfferGrp (FK to Trade offer grouping)
StartEffDate
EndEffDate
tblTradeOfferProduct (Trade offer's product)
SeqID (PK)
ProdGrp (PK/FK)
OfferID (PK/FK)
OfferQty
*Note: SeqID + ProdGrp + OfferID is unique
I need all rows from tblProduct, tblProdGrp, tblBranch,
tblTradeOfferGroup, tblTradeOffer, tblTradeOfferProduct to
replicate to subscriber, but only single branch's customer
in tblCustomer at subscriber. How should I configure the
row filter and join filter in my Merge Replication?
Currently, I configure as following:-
Row Filter:
tblCustomer row filter tblCustomer.BranchID = '001'
tblProduct <publish all rows>
tblProdGrp <publish all rows>
tblBranch <publish all rows>
tblTradeOfferGroup <publish all rows>
tblTradeOffer <publish all rows>
tblTradeOfferProduct <publish all rows>
Join Filter:
Filtered table Table to filter
tblTradeOfferGroup tblTradeOffer
tblTradeOffer.OfferGrp = tblTradeOfferGroup.OfferGrp
tblTradeOffer tblTradeOfferProduct
tblTradeOfferProduct.OfferID = tblTradeOffer.OfferID
But, tblTradeOfferProduct not replicated over. A conflict
occurs saying FOREIGN KEY constraint etc. The weird case
is, when I synchorise again, the rows publisher's
tblTradeOfferProduct are deleted.
Please advice.
Thank you.
HKM
I think, replicating tblTradeOfferProduct should fix your problem.
Since tblTradeOfferProduct has relations to tblTradeOffer (and I believe to
tblProduct too ) it is better to replicate this table.
Otherwise yuo have to declare all those relations as "NOT FOR REPLICATION"
Since you dont have "NOT FOR REPLICATION" whenever that are constraint
violatins you will see merge failing with constraint violations.
And once some entries fail to propagate to the subscriber, in the next
merge, compensating actions (deletes for all the failed inserts) are made
and hence you will see that those rows vanish from the database.
You can either set the constraints to "NOT FOR REPLICATION" or replicate the
tblTradeOfferProduct table too. One of them should fix the problem
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"HKM" <anonymous@.discussions.microsoft.com> wrote in message
news:04e801c49a0e$f4c9ebf0$a601280a@.phx.gbl...
> Hi,
> I am new to replication, I have the following tables in my
> database, and I would like to replicate to other
> subscriber using Merge Replication:
>
> tblProduct (Product master)
> --
> ProdID (PK)
> ProdGrp (FK to Product grouping)
> ProdDesc
> tblProdGrp (Product grouping)
> --
> ProdGrp (PK)
> ProdGrpDesc
> tblCustomer (Customer master)
> --
> CustID (PK)
> BranchID (FK to branch master)
> OfferGrp (FK to trade offer grouping)
> CustName
> tblBranch (Branch master)
> --
> BranchID (PK)
> BranchName
> tblTradeOfferGroup (Trade offer grouping)
> --
> OfferGrp (PK)
> OfferGrpDesc
> tblTradeOffer (Trade offer)
> --
> OfferID (PK)
> OfferGrp (FK to Trade offer grouping)
> StartEffDate
> EndEffDate
> tblTradeOfferProduct (Trade offer's product)
> --
> SeqID (PK)
> ProdGrp (PK/FK)
> OfferID (PK/FK)
> OfferQty
> *Note: SeqID + ProdGrp + OfferID is unique
> I need all rows from tblProduct, tblProdGrp, tblBranch,
> tblTradeOfferGroup, tblTradeOffer, tblTradeOfferProduct to
> replicate to subscriber, but only single branch's customer
> in tblCustomer at subscriber. How should I configure the
> row filter and join filter in my Merge Replication?
> Currently, I configure as following:-
> Row Filter:
> tblCustomer row filter tblCustomer.BranchID = '001'
> tblProduct <publish all rows>
> tblProdGrp <publish all rows>
> tblBranch <publish all rows>
> tblTradeOfferGroup <publish all rows>
> tblTradeOffer <publish all rows>
> tblTradeOfferProduct <publish all rows>
> Join Filter:
> Filtered table Table to filter
> tblTradeOfferGroup tblTradeOffer
> tblTradeOffer.OfferGrp = tblTradeOfferGroup.OfferGrp
> tblTradeOffer tblTradeOfferProduct
> tblTradeOfferProduct.OfferID = tblTradeOffer.OfferID
> But, tblTradeOfferProduct not replicated over. A conflict
> occurs saying FOREIGN KEY constraint etc. The weird case
> is, when I synchorise again, the rows publisher's
> tblTradeOfferProduct are deleted.
> Please advice.
> Thank you.
> HKM
>
I am new to replication, I have the following tables in my
database, and I would like to replicate to other
subscriber using Merge Replication:
tblProduct (Product master)
ProdID (PK)
ProdGrp (FK to Product grouping)
ProdDesc
tblProdGrp (Product grouping)
ProdGrp (PK)
ProdGrpDesc
tblCustomer (Customer master)
CustID (PK)
BranchID (FK to branch master)
OfferGrp (FK to trade offer grouping)
CustName
tblBranch (Branch master)
BranchID (PK)
BranchName
tblTradeOfferGroup (Trade offer grouping)
OfferGrp (PK)
OfferGrpDesc
tblTradeOffer (Trade offer)
OfferID (PK)
OfferGrp (FK to Trade offer grouping)
StartEffDate
EndEffDate
tblTradeOfferProduct (Trade offer's product)
SeqID (PK)
ProdGrp (PK/FK)
OfferID (PK/FK)
OfferQty
*Note: SeqID + ProdGrp + OfferID is unique
I need all rows from tblProduct, tblProdGrp, tblBranch,
tblTradeOfferGroup, tblTradeOffer, tblTradeOfferProduct to
replicate to subscriber, but only single branch's customer
in tblCustomer at subscriber. How should I configure the
row filter and join filter in my Merge Replication?
Currently, I configure as following:-
Row Filter:
tblCustomer row filter tblCustomer.BranchID = '001'
tblProduct <publish all rows>
tblProdGrp <publish all rows>
tblBranch <publish all rows>
tblTradeOfferGroup <publish all rows>
tblTradeOffer <publish all rows>
tblTradeOfferProduct <publish all rows>
Join Filter:
Filtered table Table to filter
tblTradeOfferGroup tblTradeOffer
tblTradeOffer.OfferGrp = tblTradeOfferGroup.OfferGrp
tblTradeOffer tblTradeOfferProduct
tblTradeOfferProduct.OfferID = tblTradeOffer.OfferID
But, tblTradeOfferProduct not replicated over. A conflict
occurs saying FOREIGN KEY constraint etc. The weird case
is, when I synchorise again, the rows publisher's
tblTradeOfferProduct are deleted.
Please advice.
Thank you.
HKM
I think, replicating tblTradeOfferProduct should fix your problem.
Since tblTradeOfferProduct has relations to tblTradeOffer (and I believe to
tblProduct too ) it is better to replicate this table.
Otherwise yuo have to declare all those relations as "NOT FOR REPLICATION"
Since you dont have "NOT FOR REPLICATION" whenever that are constraint
violatins you will see merge failing with constraint violations.
And once some entries fail to propagate to the subscriber, in the next
merge, compensating actions (deletes for all the failed inserts) are made
and hence you will see that those rows vanish from the database.
You can either set the constraints to "NOT FOR REPLICATION" or replicate the
tblTradeOfferProduct table too. One of them should fix the problem
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"HKM" <anonymous@.discussions.microsoft.com> wrote in message
news:04e801c49a0e$f4c9ebf0$a601280a@.phx.gbl...
> Hi,
> I am new to replication, I have the following tables in my
> database, and I would like to replicate to other
> subscriber using Merge Replication:
>
> tblProduct (Product master)
> --
> ProdID (PK)
> ProdGrp (FK to Product grouping)
> ProdDesc
> tblProdGrp (Product grouping)
> --
> ProdGrp (PK)
> ProdGrpDesc
> tblCustomer (Customer master)
> --
> CustID (PK)
> BranchID (FK to branch master)
> OfferGrp (FK to trade offer grouping)
> CustName
> tblBranch (Branch master)
> --
> BranchID (PK)
> BranchName
> tblTradeOfferGroup (Trade offer grouping)
> --
> OfferGrp (PK)
> OfferGrpDesc
> tblTradeOffer (Trade offer)
> --
> OfferID (PK)
> OfferGrp (FK to Trade offer grouping)
> StartEffDate
> EndEffDate
> tblTradeOfferProduct (Trade offer's product)
> --
> SeqID (PK)
> ProdGrp (PK/FK)
> OfferID (PK/FK)
> OfferQty
> *Note: SeqID + ProdGrp + OfferID is unique
> I need all rows from tblProduct, tblProdGrp, tblBranch,
> tblTradeOfferGroup, tblTradeOffer, tblTradeOfferProduct to
> replicate to subscriber, but only single branch's customer
> in tblCustomer at subscriber. How should I configure the
> row filter and join filter in my Merge Replication?
> Currently, I configure as following:-
> Row Filter:
> tblCustomer row filter tblCustomer.BranchID = '001'
> tblProduct <publish all rows>
> tblProdGrp <publish all rows>
> tblBranch <publish all rows>
> tblTradeOfferGroup <publish all rows>
> tblTradeOffer <publish all rows>
> tblTradeOfferProduct <publish all rows>
> Join Filter:
> Filtered table Table to filter
> tblTradeOfferGroup tblTradeOffer
> tblTradeOffer.OfferGrp = tblTradeOfferGroup.OfferGrp
> tblTradeOffer tblTradeOfferProduct
> tblTradeOfferProduct.OfferID = tblTradeOffer.OfferID
> But, tblTradeOfferProduct not replicated over. A conflict
> occurs saying FOREIGN KEY constraint etc. The weird case
> is, when I synchorise again, the rows publisher's
> tblTradeOfferProduct are deleted.
> Please advice.
> Thank you.
> HKM
>
Subscribe to:
Posts (Atom)