Friday, March 30, 2012
how to create row locks
We would like to use the following concept :
There are two processes.
First one creates the transacton, makes update on one row via the primary
key
(by the command UPDATE not by UPDATE CURSOR).
We need to achieve
that in the duration this transaction
there is not possible to execute UPDATE for this row by the second process,
but we must have the possibility to make UPDATE on the another rows.
Our problem is
that by using the above construction
the whole table is locked for the second process.
Thanks
misoMiso
By deafult SQL Server creates a lock on row level.
BEGIN TRAN
UPDATE Table SET col1 =@.par1,col2=@.par2 WHERE PK=something
COMMIT TRAN
"Miso" <valent@.spirit.sk> wrote in message
news:eQl5Hw08GHA.2128@.TK2MSFTNGP05.phx.gbl...
> Hello,
> We would like to use the following concept :
> There are two processes.
> First one creates the transacton, makes update on one row via the primary
> key
> (by the command UPDATE not by UPDATE CURSOR).
> We need to achieve
> that in the duration this transaction
> there is not possible to execute UPDATE for this row by the second
> process,
> but we must have the possibility to make UPDATE on the another rows.
> Our problem is
> that by using the above construction
> the whole table is locked for the second process.
>
> Thanks
> miso
>|||Miso,
the update on the single row within the transaction will have an exclusive
lock on that row, but as it's a single row, I don't see how lock escalation
has increased it to a table lock (an intent exclusive is expected). How many
rows are in the table? Are there other transactions operating here? What is
returned if you run sp_lock (for the relevant objid)? Also, what happens if
you use the ROWLOCK hint?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
how to create row locks
We would like to use the following concept :
There are two processes.
First one creates the transacton, makes update on one row via the primary
key
(by the command UPDATE not by UPDATE CURSOR).
We need to achieve
that in the duration this transaction
there is not possible to execute UPDATE for this row by the second process,
but we must have the possibility to make UPDATE on the another rows.
Our problem is
that by using the above construction
the whole table is locked for the second process.
Thanks
miso
Miso
By deafult SQL Server creates a lock on row level.
BEGIN TRAN
UPDATE Table SET col1 =@.par1,col2=@.par2 WHERE PK=something
COMMIT TRAN
"Miso" <valent@.spirit.sk> wrote in message
news:eQl5Hw08GHA.2128@.TK2MSFTNGP05.phx.gbl...
> Hello,
> We would like to use the following concept :
> There are two processes.
> First one creates the transacton, makes update on one row via the primary
> key
> (by the command UPDATE not by UPDATE CURSOR).
> We need to achieve
> that in the duration this transaction
> there is not possible to execute UPDATE for this row by the second
> process,
> but we must have the possibility to make UPDATE on the another rows.
> Our problem is
> that by using the above construction
> the whole table is locked for the second process.
>
> Thanks
> miso
>
|||Miso,
the update on the single row within the transaction will have an exclusive
lock on that row, but as it's a single row, I don't see how lock escalation
has increased it to a table lock (an intent exclusive is expected). How many
rows are in the table? Are there other transactions operating here? What is
returned if you run sp_lock (for the relevant objid)? Also, what happens if
you use the ROWLOCK hint?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
how to create row locks
We would like to use the following concept :
There are two processes.
First one creates the transacton, makes update on one row via the primary
key
(by the command UPDATE not by UPDATE CURSOR).
We need to achieve
that in the duration this transaction
there is not possible to execute UPDATE for this row by the second process,
but we must have the possibility to make UPDATE on the another rows.
Our problem is
that by using the above construction
the whole table is locked for the second process.
Thanks
misoMiso
By deafult SQL Server creates a lock on row level.
BEGIN TRAN
UPDATE Table SET col1 =@.par1,col2=@.par2 WHERE PK=something
COMMIT TRAN
"Miso" <valent@.spirit.sk> wrote in message
news:eQl5Hw08GHA.2128@.TK2MSFTNGP05.phx.gbl...
> Hello,
> We would like to use the following concept :
> There are two processes.
> First one creates the transacton, makes update on one row via the primary
> key
> (by the command UPDATE not by UPDATE CURSOR).
> We need to achieve
> that in the duration this transaction
> there is not possible to execute UPDATE for this row by the second
> process,
> but we must have the possibility to make UPDATE on the another rows.
> Our problem is
> that by using the above construction
> the whole table is locked for the second process.
>
> Thanks
> miso
>|||Miso,
the update on the single row within the transaction will have an exclusive
lock on that row, but as it's a single row, I don't see how lock escalation
has increased it to a table lock (an intent exclusive is expected). How many
rows are in the table? Are there other transactions operating here? What is
returned if you run sp_lock (for the relevant objid)? Also, what happens if
you use the ROWLOCK hint?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
Wednesday, March 28, 2012
How to create or save files in a different domain
Hey,
I have an SSIS package that creates a new file and saves results into that file. However, the requirement has it that I need to create this file on a server residing in a different domain. How can I achieve this in an SSIS package when it is scheduled as a job?
Thanks,
Aravind
When using SQLAgent, you should be aware of permission-related issues like the use of proxy accounts that may come into play. SSIS doesn't have special handling for different domains. For example, if you are using the flat file destination adapter to write data, it will just attempt to write to the file without recognizing where the file is residing. If you are having trouble writing directly to a file in a different domain, it might be easier if you create and write to a file locally using IS (feasibility depending on the size of file) and then copy it over using another mechanism that's proven to work across domains.|||The obvious method would be to setup a trust between the domains, and just grant permission in the normal way. If that is not an option for you, then the only other method I have used is to manipulate files accross domains is NET USE the old DOS command. You can connect to a share and supply a username and password.
Friday, March 23, 2012
How to create and schedule full-text catalogue
I have writen a database installation application that simply creates
tables inside a database. I also need to create and schedule
full-text indexing on some of my tables.
I am using SQL server 2000 and and VB.NET 2003.
Thank you,
_dino_You could generate scripts for full-text indexes from Enterprise Manager.
Here's how the scripts look like for example:
http://www.databasejournal.com/features/mssql/article.php/1459591
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:jgale198gjv7suate4st95si2v5it5tbf4@.4ax.com...
> Hi,
> I have writen a database installation application that simply creates
> tables inside a database. I also need to create and schedule
> full-text indexing on some of my tables.
> I am using SQL server 2000 and and VB.NET 2003.
> Thank you,
> _dino_
>|||Thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:
>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/features/mssql/article.php/1459591|||thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:
>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/features/mssql/article.php/1459591
Wednesday, March 21, 2012
How to create a Virtual Directory that uses instance name
I installed Reporting Services 2005 as an instance MYMACHINE\RS2005. If I do
this, the regular setup creates a Virtual Directory called
http://MYMACHINE/ReportServer$RS2005/
But if I wanted to create a similar virtual directory (say
http://MYMACHINE/TestServer$RS2005) using Reporting Services Configuration
tool, it errors out saying the virtual directory name is invalid (I just type
in TestServer$RS2005 in the virtual directory name)
How can I accomplish this?
Any help is greatly appreciated.
Thanks.Also,
I just found documentation on MSDN that said that the tool will
automatically add the instance name, but when I use the tool, it just creates
a Virtual Directory called TestServer.
"Raghu" wrote:
> Hi,
> I installed Reporting Services 2005 as an instance MYMACHINE\RS2005. If I do
> this, the regular setup creates a Virtual Directory called
> http://MYMACHINE/ReportServer$RS2005/
> But if I wanted to create a similar virtual directory (say
> http://MYMACHINE/TestServer$RS2005) using Reporting Services Configuration
> tool, it errors out saying the virtual directory name is invalid (I just type
> in TestServer$RS2005 in the virtual directory name)
> How can I accomplish this?
> Any help is greatly appreciated.
> Thanks.
Monday, March 12, 2012
How to create a Maintenance Plan and backup to multiple locations
Currently, I have a maintenance plan and it creates a complete backup to the
default backup directory on the local machine.
What should I do if I also want to back up the database to another
machine/share drive on the same domain? Do I need to create a new
maintenance plan just for that? Could this create unnecessary performance
hit on the SQL Server?
Or could I go directly to the SQL job and modify the script so that it can
back up to multiple locations? I don’t know how to do this or whether it
will work at all.
Sure I can create a NT backup to copy the database to another location. But
I really like the "Remove file older than..." feature on the maintenance
plan. Our database is pretty big and the currently backup mechanism faces
space issue without this "Remove file older than..." feature.
Any advice? And thanks in advance.
Abel Chan
You can send the backup file anywhere you want as long as the account that
SQL Server runs under has permissions to that share or folder. But with
SQL2000 you can not backup to two locations at once. SQL2005 gives you more
options in that area. It is rarely a good idea to backup to the default
directory since if that machine dies you loose botht he db and the most
current backup. You might want to think about backing up to a remote share.
Just use a UNC for the path in the MP wizard (or edit the job) and you
should be all set.
Andrew J. Kelly SQL MVP
"Abel Chan" <awong@.newsgroup.nospam> wrote in message
news:341680AD-9EF2-4574-9BF6-CE4E391DF2D8@.microsoft.com...
> Hi all,
> Currently, I have a maintenance plan and it creates a complete backup to
> the
> default backup directory on the local machine.
> What should I do if I also want to back up the database to another
> machine/share drive on the same domain? Do I need to create a new
> maintenance plan just for that? Could this create unnecessary performance
> hit on the SQL Server?
> Or could I go directly to the SQL job and modify the script so that it can
> back up to multiple locations? I don't know how to do this or whether it
> will work at all.
> Sure I can create a NT backup to copy the database to another location.
> But
> I really like the "Remove file older than..." feature on the maintenance
> plan. Our database is pretty big and the currently backup mechanism faces
> space issue without this "Remove file older than..." feature.
> Any advice? And thanks in advance.
> Abel Chan
>
How to create a Maintenance Plan and backup to multiple locations
Currently, I have a maintenance plan and it creates a complete backup to the
default backup directory on the local machine.
What should I do if I also want to back up the database to another
machine/share drive on the same domain? Do I need to create a new
maintenance plan just for that? Could this create unnecessary performance
hit on the SQL Server?
Or could I go directly to the SQL job and modify the script so that it can
back up to multiple locations? I donâ't know how to do this or whether it
will work at all.
Sure I can create a NT backup to copy the database to another location. But
I really like the "Remove file older than..." feature on the maintenance
plan. Our database is pretty big and the currently backup mechanism faces
space issue without this "Remove file older than..." feature.
Any advice? And thanks in advance.
Abel ChanYou can send the backup file anywhere you want as long as the account that
SQL Server runs under has permissions to that share or folder. But with
SQL2000 you can not backup to two locations at once. SQL2005 gives you more
options in that area. It is rarely a good idea to backup to the default
directory since if that machine dies you loose botht he db and the most
current backup. You might want to think about backing up to a remote share.
Just use a UNC for the path in the MP wizard (or edit the job) and you
should be all set.
--
Andrew J. Kelly SQL MVP
"Abel Chan" <awong@.newsgroup.nospam> wrote in message
news:341680AD-9EF2-4574-9BF6-CE4E391DF2D8@.microsoft.com...
> Hi all,
> Currently, I have a maintenance plan and it creates a complete backup to
> the
> default backup directory on the local machine.
> What should I do if I also want to back up the database to another
> machine/share drive on the same domain? Do I need to create a new
> maintenance plan just for that? Could this create unnecessary performance
> hit on the SQL Server?
> Or could I go directly to the SQL job and modify the script so that it can
> back up to multiple locations? I don't know how to do this or whether it
> will work at all.
> Sure I can create a NT backup to copy the database to another location.
> But
> I really like the "Remove file older than..." feature on the maintenance
> plan. Our database is pretty big and the currently backup mechanism faces
> space issue without this "Remove file older than..." feature.
> Any advice? And thanks in advance.
> Abel Chan
>|||Hi Andrew,
Thanks to your response. I took your suggestion and back up the database to
another media. :> I also found that I need to run the SQL server under a
domain account instead of Local System in order to use UNC path. Thanks
again.
Abel Chan
"Andrew J. Kelly" wrote:
> You can send the backup file anywhere you want as long as the account that
> SQL Server runs under has permissions to that share or folder. But with
> SQL2000 you can not backup to two locations at once. SQL2005 gives you more
> options in that area. It is rarely a good idea to backup to the default
> directory since if that machine dies you loose botht he db and the most
> current backup. You might want to think about backing up to a remote share.
> Just use a UNC for the path in the MP wizard (or edit the job) and you
> should be all set.
> --
> Andrew J. Kelly SQL MVP
>
> "Abel Chan" <awong@.newsgroup.nospam> wrote in message
> news:341680AD-9EF2-4574-9BF6-CE4E391DF2D8@.microsoft.com...
> > Hi all,
> >
> > Currently, I have a maintenance plan and it creates a complete backup to
> > the
> > default backup directory on the local machine.
> >
> > What should I do if I also want to back up the database to another
> > machine/share drive on the same domain? Do I need to create a new
> > maintenance plan just for that? Could this create unnecessary performance
> > hit on the SQL Server?
> >
> > Or could I go directly to the SQL job and modify the script so that it can
> > back up to multiple locations? I don't know how to do this or whether it
> > will work at all.
> >
> > Sure I can create a NT backup to copy the database to another location.
> > But
> > I really like the "Remove file older than..." feature on the maintenance
> > plan. Our database is pretty big and the currently backup mechanism faces
> > space issue without this "Remove file older than..." feature.
> >
> > Any advice? And thanks in advance.
> >
> > Abel Chan
> >
>
>
How to create a Maintenance Plan and backup to multiple locations
Currently, I have a maintenance plan and it creates a complete backup to the
default backup directory on the local machine.
What should I do if I also want to back up the database to another
machine/share drive on the same domain? Do I need to create a new
maintenance plan just for that? Could this create unnecessary performance
hit on the SQL Server?
Or could I go directly to the SQL job and modify the script so that it can
back up to multiple locations? I don’t know how to do this or whether it
will work at all.
Sure I can create a NT backup to copy the database to another location. But
I really like the "Remove file older than..." feature on the maintenance
plan. Our database is pretty big and the currently backup mechanism faces
space issue without this "Remove file older than..." feature.
Any advice? And thanks in advance.
Abel ChanYou can send the backup file anywhere you want as long as the account that
SQL Server runs under has permissions to that share or folder. But with
SQL2000 you can not backup to two locations at once. SQL2005 gives you more
options in that area. It is rarely a good idea to backup to the default
directory since if that machine dies you loose botht he db and the most
current backup. You might want to think about backing up to a remote share.
Just use a UNC for the path in the MP wizard (or edit the job) and you
should be all set.
Andrew J. Kelly SQL MVP
"Abel Chan" <awong@.newsgroup.nospam> wrote in message
news:341680AD-9EF2-4574-9BF6-CE4E391DF2D8@.microsoft.com...
> Hi all,
> Currently, I have a maintenance plan and it creates a complete backup to
> the
> default backup directory on the local machine.
> What should I do if I also want to back up the database to another
> machine/share drive on the same domain? Do I need to create a new
> maintenance plan just for that? Could this create unnecessary performance
> hit on the SQL Server?
> Or could I go directly to the SQL job and modify the script so that it can
> back up to multiple locations? I don't know how to do this or whether it
> will work at all.
> Sure I can create a NT backup to copy the database to another location.
> But
> I really like the "Remove file older than..." feature on the maintenance
> plan. Our database is pretty big and the currently backup mechanism faces
> space issue without this "Remove file older than..." feature.
> Any advice? And thanks in advance.
> Abel Chan
>
Friday, March 9, 2012
How to create a DUMP table in MSSQL
In mySQL it is easy to create a DUMP table which when run creates the table and inserts the data ....
In MSSQL I can create a file which I can use to re-create the table but I can not see how to also add the data with out doing a backup in MSSQL ... anyone know where this is possible?
There are a couple of choices;1/ export the data out as text by using BCP or Integration Services.
2/ Instead of scripting data and schema just detach the database from one instance, copy it and then attach on the other end.
BCP is a sql solution, there is UI for the others under All Tasks on a right click.