Friday, March 30, 2012
how to simulate a block
a blocking script I want to implement on prod.
TIA
C
Execute this on one connection:
create table ##foo (SomeColumn int)
go
begin transaction
insert into ##foo (SomeColumn) values (1)
waitfor delay '0:00:40' /* hold the transaction open for 40 seconds */
go
commit transaction
/*****************************/
Execute this on another connection:
select * from ##foo
Keith
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:%23PbFfLMeFHA.1920@.tk2msftngp13.phx.gbl...
> could someone provide some simple code to simulate a block. I want to
> test a blocking script I want to implement on prod.
> TIA
> C
>
|||Try,
-- conn 1
use northwind
go
begin transaction
update orders
set orderdate = orderdate
-- conn 2
use northwind
go
select * from orders
Connection 2 will be blocked until you commit or rollback the transaction in
connection 1.
AMB
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to test
> a blocking script I want to implement on prod.
> TIA
> C
>
>
|||Look at tablockx holdlock keywords
these will hold locks on tables with in a block of code...
i.e.
create procedure ...
select @.nextid = id from foo with (tablockx holdlock)
/* tablockx forces an exclusive table lock
tablock to do a non-exclusive lock
holdlock tells SQL Server to hold locks for duration of the transaction */
update foo set [id] = [id]+ @.block
return @.nextid
...
this will prevent n users from getting the same id
GO
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to test
> a blocking script I want to implement on prod.
> TIA
> C
>
>
how to simulate a block
a blocking script I want to implement on prod.
TIA
CExecute this on one connection:
create table ##foo (SomeColumn int)
go
begin transaction
insert into ##foo (SomeColumn) values (1)
waitfor delay '0:00:40' /* hold the transaction open for 40 seconds */
go
commit transaction
/*****************************/
Execute this on another connection:
select * from ##foo
Keith
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:%23PbFfLMeFHA.1920@.tk2msftngp13.phx.gbl...
> could someone provide some simple code to simulate a block. I want to
> test a blocking script I want to implement on prod.
> TIA
> C
>|||Try,
-- conn 1
use northwind
go
begin transaction
update orders
set orderdate = orderdate
-- conn 2
use northwind
go
select * from orders
Connection 2 will be blocked until you commit or rollback the transaction in
connection 1.
AMB
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to tes
t
> a blocking script I want to implement on prod.
> TIA
> C
>
>|||Look at tablockx holdlock keywords
these will hold locks on tables with in a block of code...
i.e.
create procedure ...
select @.nextid = id from foo with (tablockx holdlock)
/* tablockx forces an exclusive table lock
tablock to do a non-exclusive lock
holdlock tells SQL Server to hold locks for duration of the transaction */
update foo set [id] = [id]+ @.block
return @.nextid
...
this will prevent n users from getting the same id
GO
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to tes
t
> a blocking script I want to implement on prod.
> TIA
> C
>
>sql
how to simulate a block
a blocking script I want to implement on prod.
TIA
CExecute this on one connection:
create table ##foo (SomeColumn int)
go
begin transaction
insert into ##foo (SomeColumn) values (1)
waitfor delay '0:00:40' /* hold the transaction open for 40 seconds */
go
commit transaction
/*****************************/
Execute this on another connection:
select * from ##foo
Keith
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:%23PbFfLMeFHA.1920@.tk2msftngp13.phx.gbl...
> could someone provide some simple code to simulate a block. I want to
> test a blocking script I want to implement on prod.
> TIA
> C
>|||Try,
-- conn 1
use northwind
go
begin transaction
update orders
set orderdate = orderdate
-- conn 2
use northwind
go
select * from orders
Connection 2 will be blocked until you commit or rollback the transaction in
connection 1.
AMB
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to test
> a blocking script I want to implement on prod.
> TIA
> C
>
>|||Look at tablockx holdlock keywords
these will hold locks on tables with in a block of code...
i.e.
create procedure ...
select @.nextid = id from foo with (tablockx holdlock)
/* tablockx forces an exclusive table lock
tablock to do a non-exclusive lock
holdlock tells SQL Server to hold locks for duration of the transaction */
update foo set [id] = [id]+ @.block
return @.nextid
...
this will prevent n users from getting the same id
GO
"CD" wrote:
> could someone provide some simple code to simulate a block. I want to test
> a blocking script I want to implement on prod.
> TIA
> C
>
>
Wednesday, March 21, 2012
How to set up replication from SQL Server 2005 to MySQL through ODBC
Can anyone please provide me with a step-by-step explanation on how to
replicate data (snapshot replication) from a table in a SQL Server
2005 database to a table in a MySQL database through an ODBC
connection?
I have already created a publication, but have not succeeded in
successfully adding a subscription. I know that I have to use the
stored procedures "sp_addsubscription" and
"sp_addpushsubscription_agent", but cannot figure out how to set up
the parameters to get it to work. Any help on this issue would be
greatly appreciated.
Thanks
This is not supported in SQL 2005. It was in SQL 2000 but there was a bug
last time I checked.
<ronald.debruin@.ecorys.com> wrote in message
news:1177595848.403994.88300@.n35g2000prd.googlegro ups.com...
> Hi,
> Can anyone please provide me with a step-by-step explanation on how to
> replicate data (snapshot replication) from a table in a SQL Server
> 2005 database to a table in a MySQL database through an ODBC
> connection?
> I have already created a publication, but have not succeeded in
> successfully adding a subscription. I know that I have to use the
> stored procedures "sp_addsubscription" and
> "sp_addpushsubscription_agent", but cannot figure out how to set up
> the parameters to get it to work. Any help on this issue would be
> greatly appreciated.
> Thanks
>
Friday, March 9, 2012
How To Set Multiple ReadOnlyVariables in Script Component in Integration Services 2005
Hello!
I'ave got a problem of setting more than one Variable in ReadOnlyVariables Property of ScriptComponent...I provide comma separated list of names ( As described in the help ) byt VS Studio Editor can not be opoened claiming that there is no a variablle with such a name...Looks like it doesn't treat the list as a collection of names...
Please help.
Vladimir
Make sure there are no spaces in the list.Var1,Var2,Var3
This will not work:
Var1, Var2, Var3
Also note that variable names are case sensitive.|||Triple-check your spelling and the scope your variables are defined in. I got the error just this morning and it was a spelling problem.
|||
Thanks for your response...
I verified the spelling got rid of spaces...but result is the same
It is interesting thing.. I have only two variables: One is set on a package level and another is on the Data Flow Task level...
When I set one of them in ReadonlyVariables and another in ReadandWriteVariables it allows me to open VS for Applications. If I move both to the same location ( ReadonLy or ReadAnd Write with comma separation and no spaces ) it issues the message I described...
I tried specifying the namespaces for the variables, but with no Luck...
Not usre what to do...
Any ideas will be greately appreciated...
Thanks,
Vladimir
|||What version of SSIS are you using?RTM? SP1? SP2?
Sunday, February 19, 2012
How to set a column to be an identity column in TSQL.
in a stored proceedure. When I export my database, my identity columns are
no longer identity columns.I don't beleive you can add an Identity property to an existing column.
You may need to create a temp table with the identity column in it, copy the
data to the temp table, drop the existing table and then rename your temp
one.
"Jim Mitchell" <jim_mitchell@.mindspring.com> wrote in message
news:uSn1WWFfDHA.1732@.TK2MSFTNGP12.phx.gbl...
> Can someone provide the syntax for setting a column to be an identity
column
> in a stored proceedure. When I export my database, my identity columns
are
> no longer identity columns.
>