Showing posts with label updating. Show all posts
Showing posts with label updating. Show all posts

Thursday, March 22, 2012

Change default rowlock on SQL Server

Hello!

Does anyone know if there is a setting on MS SQL server to tell it to always lock a row for updating when attemping to change a record? I have a program that does a select statement and the user can then choose which records to edit. Once they select to edit a record, I need the sql server to prevent other users from editing that record. I know I can use the 'Updlock' hint but was hoping there was just a default setting on the server I could change. Thank you!In SQL2K row locking is default, if more locks required, this could escalate to page lock or full table lock. In SQL2K there is no way to change this behavior except using hints or isolation level, you can play also with indexes to obtain key locks and with cursor modes.

HTH,
OBRP|||Also refer thru books online for LOCKS topic which has been explained.

Monday, March 19, 2012

change data types

Hi,
The company I work is updating our software for
localization/internationalization. Unfortunately, when we built our backend
design, we did not foresee needing to go international. So almost all of
our text data types are not built for internationalization. Basically, the
only fields we really need to change are text and varchar, to ntext and
nvarchar. Are there any issues with running a SQL script as part of a
service pack, in order to change these data types in the tables?
If there are or aren't any problems, are there any articles someone can
point me to. Most articles I have found on localization deal specifically
with creating a new application.
So in summary, I need to know if there are any issues with changing a text
to an ntext and varchar to an nvarchar. Additionally, there may be some
char fields that need to be changed to nchar.
Any help/direction/articles would be very much appreciated. Thank you.
Paul
Well, one issue that pops to mind immediately is that if you have a
VARCHAR(8000) and it has 4001 characters or more, you're going to lose data.
NVARCHAR can only go to 4000, since every character takes two bytes.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Paul" <paul@.gotheta.com> wrote in message
news:ebUJn1sMEHA.2628@.TK2MSFTNGP12.phx.gbl...
> Hi,
> The company I work is updating our software for
> localization/internationalization. Unfortunately, when we built our
backend
> design, we did not foresee needing to go international. So almost all of
> our text data types are not built for internationalization. Basically,
the
> only fields we really need to change are text and varchar, to ntext and
> nvarchar. Are there any issues with running a SQL script as part of a
> service pack, in order to change these data types in the tables?
> If there are or aren't any problems, are there any articles someone can
> point me to. Most articles I have found on localization deal specifically
> with creating a new application.
> So in summary, I need to know if there are any issues with changing a text
> to an ntext and varchar to an nvarchar. Additionally, there may be some
> char fields that need to be changed to nchar.
> Any help/direction/articles would be very much appreciated. Thank you.
> Paul
>

Saturday, February 25, 2012

Cerating and updating new record using ADO

Hi, i want to create new record in remote accsess db using ADO. I'm using this code:

VB:
------------------------
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset

cnn.Open "Provider=MS Remote;Remote Server=http://www.xyz.com;" & "Remote Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\Inetpub\wwwroot\biblio.mdb;"
rs.Open "SELECT * From USERS", cnn, adOpenKeyset, adLockOptimistic, adCmdText

rs.AddNew
rs("Name") = "Jon"
rs("PhoneNR") = "00375221"
rs.Update
------------------------

error apears when i updating recrodset:

'-21474671259' operation must use an updateable query

Why ??Originally posted by fizikas
Hi, i want to create new record in remote accsess db using ADO. I'm using this code:

VB:
------------------------
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset

cnn.Open "Provider=MS Remote;Remote Server=http://www.xyz.com;" & "Remote Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\Inetpub\wwwroot\biblio.mdb;"
rs.Open "SELECT * From USERS", cnn, adOpenKeyset, adLockOptimistic, adCmdText

rs.AddNew
rs("Name") = "Jon"
rs("PhoneNR") = "00375221"
rs.Update
------------------------

error apears when i updating recrodset:

'-21474671259' operation must use an updateable query

Why ??

see the following article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;175168