Showing posts with label including. Show all posts
Showing posts with label including. Show all posts

Friday, March 23, 2012

Lock and update problem

Hello,
I use sql server 2000.
I want to create the following stored procedure:
I have a table with serveral field including the field "isqueued"
I want to select one record (select top 1) from the table and immediatly
update the iqueued field to "true" while locking the record.
This to make sure that no other thread is going the read the same record and
use it.
Any ideas on how to do this?
Thanks in advance for the helpGM
BEGIN TRAN
SELECT <> FROM Table WITH (UPDLOCK,HOLDLOCK) WHERE blbalabl;
UPDATE Table_Other SET blblb;
COMMIT
Note : There is not true datatype in SQL Server . You probably menat to
update this column to 1 OR 0 did not you?
"GM" <invalid@.invalid.com> wrote in message
news:%239$Li0kBGHA.1372@.TK2MSFTNGP14.phx.gbl...
> Hello,
> I use sql server 2000.
> I want to create the following stored procedure:
> I have a table with serveral field including the field "isqueued"
> I want to select one record (select top 1) from the table and immediatly
> update the iqueued field to "true" while locking the record.
> This to make sure that no other thread is going the read the same record
> and use it.
> Any ideas on how to do this?
> Thanks in advance for the help
>|||> Note : There is not true datatype in SQL Server . You probably menat to
> update this column to 1 OR 0 did not you?
>
Indeed, 0 or 1
I'll give this a try|||have you considered using a message queue?

Wednesday, March 21, 2012

Location of SQL

I have an SQL server with a number of databses including :
Sharepoint and SMS. I would like to move these databases to the D
partition and they are currently in the C:\ partition.
How can this be done ?
Easiest is to us sp_detach_db and sp_attach_db (documented in Books Online).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?
|||options
1. Detach / Attach
2. Backup / Restore with MOVE
3. add files on d drive to file group
DBBC SHRINKFILE with EMPTRYFILE
drop old files
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?
|||Hi thanks for your response. How Do I move the databses using EM ? Also
How do I attach , detack with EM ?
"jaylou" wrote:
[vbcol=seagreen]
> The easiest way would be to detach the databases, Move the MDF and LDF files
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
|||Hi , I found out how to detach but i am having the problem with one
datbase. A databse that is named tembdb which is 5GB in size
"jaylou" wrote:
[vbcol=seagreen]
> The easiest way would be to detach the databases, Move the MDF and LDF files
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
|||The easiest way would be to detach the databases, Move the MDF and LDF files
to the new location and re-attach the databases.
You can do this all in Enterprise Manager. You can also set the default
location to your new location of these databases thru EM Properties of the
Server.
HTH,
Joe
"scuba19" wrote:

> I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?
|||tempdb is a system database that is used to proccess queryies...refer to
Books Online
to move this database you can simply use ALTER DATABASE...
if you restart your sql server ,this db will shrink back to its origional
size...determined by the settings of the model db
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...[vbcol=seagreen]
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:
|||http://support.microsoft.com/default...22120121120120
"David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
news:uFfhhZNAGHA.356@.TK2MSFTNGP12.phx.gbl...
> tempdb is a system database that is used to proccess queryies...refer to
> Books Online
> to move this database you can simply use ALTER DATABASE...
> if you restart your sql server ,this db will shrink back to its origional
> size...determined by the settings of the model db
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...
>
|||I am not able to do this to a databse named tempdb which is 5 GB in size ?
"David J. Cartwright" wrote:

> options
> 1. Detach / Attach
> 2. Backup / Restore with MOVE
> 3. add files on d drive to file group
> DBBC SHRINKFILE with EMPTRYFILE
> drop old files
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>
>
|||What problem are you having with TempDB? Did you move Master and model as
well?
I never tried to do this with system DBs only my own created DBs.
"scuba19" wrote:
[vbcol=seagreen]
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:

Location of SQL

I have an SQL server with a number of databses including :
Sharepoint and SMS. I would like to move these databases to the D
partition and they are currently in the C:\ partition.
How can this be done ?Easiest is to us sp_detach_db and sp_attach_db (documented in Books Online).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||options
1. Detach / Attach
2. Backup / Restore with MOVE
3. add files on d drive to file group
DBBC SHRINKFILE with EMPTRYFILE
drop old files
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||Hi thanks for your response. How Do I move the databses using EM ? Also
How do I attach , detack with EM ?
"jaylou" wrote:
[vbcol=seagreen]
> The easiest way would be to detach the databases, Move the MDF and LDF fil
es
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
>|||Hi , I found out how to detach but i am having the problem with one
datbase. A databse that is named tembdb which is 5GB in size
"jaylou" wrote:
[vbcol=seagreen]
> The easiest way would be to detach the databases, Move the MDF and LDF fil
es
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
>|||The easiest way would be to detach the databases, Move the MDF and LDF files
to the new location and re-attach the databases.
You can do this all in Enterprise Manager. You can also set the default
location to your new location of these databases thru EM Properties of the
Server.
HTH,
Joe
"scuba19" wrote:

> I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||tempdb is a system database that is used to proccess queryies...refer to
Books Online
to move this database you can simply use ALTER DATABASE...
if you restart your sql server ,this db will shrink back to its origional
size...determined by the settings of the model db
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...[vbcol=seagreen]
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:
>|||21120120" target="_blank">http://support.microsoft.com/defaul...br />
21120120
"David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
news:uFfhhZNAGHA.356@.TK2MSFTNGP12.phx.gbl...
> tempdb is a system database that is used to proccess queryies...refer to
> Books Online
> to move this database you can simply use ALTER DATABASE...
> if you restart your sql server ,this db will shrink back to its origional
> size...determined by the settings of the model db
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...
>|||I am not able to do this to a databse named tempdb which is 5 GB in size ?
"David J. Cartwright" wrote:

> options
> 1. Detach / Attach
> 2. Backup / Restore with MOVE
> 3. add files on d drive to file group
> DBBC SHRINKFILE with EMPTRYFILE
> drop old files
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>
>|||What problem are you having with TempDB? Did you move Master and model as
well?
I never tried to do this with system DBs only my own created DBs.
"scuba19" wrote:
[vbcol=seagreen]
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:
>

Location of SQL

I have an SQL server with a number of databses including :
Sharepoint and SMS. I would like to move these databases to the D
partition and they are currently in the C:\ partition.
How can this be done ?Easiest is to us sp_detach_db and sp_attach_db (documented in Books Online).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||options
1. Detach / Attach
2. Backup / Restore with MOVE
3. add files on d drive to file group
DBBC SHRINKFILE with EMPTRYFILE
drop old files
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
>I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||Hi thanks for your response. How Do I move the databses using EM ? Also
How do I attach , detack with EM ?
"jaylou" wrote:
> The easiest way would be to detach the databases, Move the MDF and LDF files
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
> > I have an SQL server with a number of databses including :
> >
> > Sharepoint and SMS. I would like to move these databases to the D
> > partition and they are currently in the C:\ partition.
> >
> > How can this be done ?|||Hi , I found out how to detach but i am having the problem with one
datbase. A databse that is named tembdb which is 5GB in size
"jaylou" wrote:
> The easiest way would be to detach the databases, Move the MDF and LDF files
> to the new location and re-attach the databases.
> You can do this all in Enterprise Manager. You can also set the default
> location to your new location of these databases thru EM Properties of the
> Server.
> HTH,
> Joe
>
> "scuba19" wrote:
> > I have an SQL server with a number of databses including :
> >
> > Sharepoint and SMS. I would like to move these databases to the D
> > partition and they are currently in the C:\ partition.
> >
> > How can this be done ?|||The easiest way would be to detach the databases, Move the MDF and LDF files
to the new location and re-attach the databases.
You can do this all in Enterprise Manager. You can also set the default
location to your new location of these databases thru EM Properties of the
Server.
HTH,
Joe
"scuba19" wrote:
> I have an SQL server with a number of databses including :
> Sharepoint and SMS. I would like to move these databases to the D
> partition and they are currently in the C:\ partition.
> How can this be done ?|||tempdb is a system database that is used to proccess queryies...refer to
Books Online
to move this database you can simply use ALTER DATABASE...
if you restart your sql server ,this db will shrink back to its origional
size...determined by the settings of the model db
"scuba19" <scuba19@.discussions.microsoft.com> wrote in message
news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:
>> The easiest way would be to detach the databases, Move the MDF and LDF
>> files
>> to the new location and re-attach the databases.
>> You can do this all in Enterprise Manager. You can also set the default
>> location to your new location of these databases thru EM Properties of
>> the
>> Server.
>> HTH,
>> Joe
>>
>> "scuba19" wrote:
>> > I have an SQL server with a number of databses including :
>> >
>> > Sharepoint and SMS. I would like to move these databases to the D
>> > partition and they are currently in the C:\ partition.
>> >
>> > How can this be done ?|||http://support.microsoft.com/default.aspx?scid=kb;en-us;224071#XSLTH3207121122120121120120
"David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
news:uFfhhZNAGHA.356@.TK2MSFTNGP12.phx.gbl...
> tempdb is a system database that is used to proccess queryies...refer to
> Books Online
> to move this database you can simply use ALTER DATABASE...
> if you restart your sql server ,this db will shrink back to its origional
> size...determined by the settings of the model db
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D3D4B487-6C03-41DE-AE62-BE5944C4D504@.microsoft.com...
>> Hi , I found out how to detach but i am having the problem with one
>> datbase. A databse that is named tembdb which is 5GB in size
>> "jaylou" wrote:
>> The easiest way would be to detach the databases, Move the MDF and LDF
>> files
>> to the new location and re-attach the databases.
>> You can do this all in Enterprise Manager. You can also set the default
>> location to your new location of these databases thru EM Properties of
>> the
>> Server.
>> HTH,
>> Joe
>>
>> "scuba19" wrote:
>> > I have an SQL server with a number of databses including :
>> >
>> > Sharepoint and SMS. I would like to move these databases to the D
>> > partition and they are currently in the C:\ partition.
>> >
>> > How can this be done ?
>|||I am not able to do this to a databse named tempdb which is 5 GB in size ?
"David J. Cartwright" wrote:
> options
> 1. Detach / Attach
> 2. Backup / Restore with MOVE
> 3. add files on d drive to file group
> DBBC SHRINKFILE with EMPTRYFILE
> drop old files
> "scuba19" <scuba19@.discussions.microsoft.com> wrote in message
> news:D954B376-1C4F-449E-B25D-0DF5CDA0FA59@.microsoft.com...
> >I have an SQL server with a number of databses including :
> >
> > Sharepoint and SMS. I would like to move these databases to the D
> > partition and they are currently in the C:\ partition.
> >
> > How can this be done ?
>
>|||What problem are you having with TempDB? Did you move Master and model as
well?
I never tried to do this with system DBs only my own created DBs.
"scuba19" wrote:
> Hi , I found out how to detach but i am having the problem with one
> datbase. A databse that is named tembdb which is 5GB in size
> "jaylou" wrote:
> > The easiest way would be to detach the databases, Move the MDF and LDF files
> > to the new location and re-attach the databases.
> > You can do this all in Enterprise Manager. You can also set the default
> > location to your new location of these databases thru EM Properties of the
> > Server.
> >
> > HTH,
> > Joe
> >
> >
> > "scuba19" wrote:
> >
> > > I have an SQL server with a number of databses including :
> > >
> > > Sharepoint and SMS. I would like to move these databases to the D
> > > partition and they are currently in the C:\ partition.
> > >
> > > How can this be done ?