I Don't Understand Quoted_identifier

Mar 24, 2008

OK, so I know that following works if I want update/insert the value "joe's bar" into the table.


set SET QUOTED_IDENTIFIER on
update #temp set id=4 where name ='joe''s bar'


The thing is, I do not conceptually understand what is happening and it is driving me nuts. I have read and re-read the description of quoted_identifier in books online and I still don't get it. How does the extra ' after joe make it work? Is there any hope for me? :)

View 4 Replies


ADVERTISEMENT

SET QUOTED_IDENTIFIER OFF

Jul 20, 2005

Hello!How bad is it to use SET QUOTED_IDENTIFIER OFF before an INSERT andthen switch it ON straight afterwards. So I can insert strings likeO'Neil etc.It's my only design option at the moment. Everything works fine and asfar as I can see, it's only set to OFF for the currentconnection/session so no other users will run into problems at thesame time if they need it ON, right?Thanks Martin

View 4 Replies View Related

Question On QUOTED_IDENTIFIER

Jul 21, 2006

I have a very strange problem, it only happen to one SQL Server, otherSQL Server seems to be fineI got the following error when trying to run a sp against one of theSQL Server:SELECT failed because the following SET options have incorrectsettings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct foruse with indexed views and/or indexes on computed columns and/or querynotifications and/or xml data type methods.If I put the SET QUOTED_IDENTIFIER OFF In the beginning of the sp,everything works fine, but the questions is why should I do that? andwhy it only happen to only one SQLServer ? The database option onQUOTED_IDENTIFIER are off on all SQLServer. (I am using SQL2005)Thanks in advance.JohnEnclose is the statement that create the databaseif db_id('testdb') is not nulldrop database [testdb]gobeginUSE [master]CREATE DATABASE [testdb] ON PRIMARY( NAME = N'testdb',FILENAME = N'C:Program FilesMicrosoft SQLServerMSSQL.1MSSQLDATA estdb.mdf' ,SIZE = 8192KB ,MAXSIZE = UNLIMITED,FILEGROWTH = 1024KB )LOG ON( NAME = N'testdb_log',FILENAME = N'C:Program FilesMicrosoft SQLServerMSSQL.1MSSQLDATA estdb_log.ldf' ,SIZE = 29504KB ,MAXSIZE = 2048GB ,FILEGROWTH = 10%)COLLATE SQL_Latin1_General_CP1_CI_ASEXEC dbo.sp_dbcmptlevel @dbname=N'testdb',@new_cmptlevel=90ALTER DATABASE [testdb] SET ANSI_NULL_DEFAULT OFFALTER DATABASE [testdb] SET ANSI_NULLS OFFALTER DATABASE [testdb] SET ANSI_PADDING OFFALTER DATABASE [testdb] SET ANSI_WARNINGS OFFALTER DATABASE [testdb] SET ARITHABORT OFFALTER DATABASE [testdb] SET AUTO_CLOSE OFFALTER DATABASE [testdb] SET AUTO_CREATE_STATISTICS ONALTER DATABASE [testdb] SET AUTO_SHRINK OFFALTER DATABASE [testdb] SET AUTO_UPDATE_STATISTICS ONALTER DATABASE [testdb] SET CURSOR_CLOSE_ON_COMMIT OFFALTER DATABASE [testdb] SET CURSOR_DEFAULT GLOBALALTER DATABASE [testdb] SET CONCAT_NULL_YIELDS_NULL OFFALTER DATABASE [testdb] SET NUMERIC_ROUNDABORT OFFALTER DATABASE [testdb] SET QUOTED_IDENTIFIER OFFALTER DATABASE [testdb] SET RECURSIVE_TRIGGERS OFFALTER DATABASE [testdb] SET ENABLE_BROKERALTER DATABASE [testdb]SETAUTO_UPDATE_STATISTICS_ASYNC ONALTER DATABASE [testdb]SETDATE_CORRELATION_OPTIMIZATION OFFALTER DATABASE [testdb] SET TRUSTWORTHY OFFALTER DATABASE [testdb] SET ALLOW_SNAPSHOT_ISOLATION ONALTER DATABASE [testdb] SET PARAMETERIZATION SIMPLEALTER DATABASE [testdb] SET READ_WRITEALTER DATABASE [testdb] SET RECOVERY FULLALTER DATABASE [testdb] SET MULTI_USERALTER DATABASE [testdb] SET PAGE_VERIFY CHECKSUMALTER DATABASE [testdb] SET DB_CHAINING OFFend

View 4 Replies View Related

QUOTED_IDENTIFIER && ANSI_NULLS

Dec 2, 2007

does anyone know how to keep QA from adding the lines setting thesetwo options on and off along with blank lines at the beginning and endof every object you edit? i have searched quite a bit on this buthaven't been able to come up with anything.

View 1 Replies View Related

SET QUOTED_IDENTIFIER Question

Jul 13, 2007

When I execute a SET QUOTED_IDENTIFIER statement, does it only apply to the current batch or current connection? I noticed it doesn't change the "Quoted Identifiers Enabled" setting in the Options page of the Database Properties in Management Studio.



Thanks,



-Dave

View 5 Replies View Related

Find Which SPs Have Quoted_identifier Set Wrong

Jul 31, 2006

Our client's application software requires all stored procedures tohave quoted_identifier set a certain way. I've tripped over this afew times and promptly fixed it, but this morning, I had totroubleshoot a case where someone else tripped over it. In such asituation, how can I identify which SP(s) have it set the wrong way?(No huge rush, the someone-else has already fixed the recent case)SQL 2K, SP3

View 2 Replies View Related

XQuery Requires QUOTED_IDENTIFIER

Dec 13, 2005

I am working for a client that would has XML data being passed into a Service Broker queue.

View 8 Replies View Related

Set QUOTED_IDENTIFIER And ANSI_NULLS On All Objects...

Sep 6, 2006

Is there any way via T-SQL to run through a database and ensure that QUOTED_IDENTIFIER and ANSI_NULLS is set for all stored procs and functions etc on a database without having to recreate every proc / fn ?

The reason this is an issue is I'm trying to take advantage of indexed views to get a performance increase in an application - but not all of the procs/fn's have historically been created with ANSI_NULLS and QUOTED_IDENTIFIER set - so any proc that's not set correctly will fail once the indexed view has been created.

I could I suppose, script out all the procs / functions and do a bit of search and replace to ensure that these are set correctly by recreating all procs and functions - but I'm trying to avoid doing that as I've over 500 databases to upgrade - a metadata hack may be preferable.


Thoughts or comments or possible alternative approaches are welcome...

View 3 Replies View Related

Incorrect Settings: 'ANSI_NULLS., QUOTED_IDENTIFIER'.

Jul 20, 2005

Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER'."error after creating a view.We wanted a composite unique constraint that ignored nulls, so we setup a view using the following script:/* --- start --- */BEGIN TRANSACTIONSET QUOTED_IDENTIFIER ONSET ARITHABORT ONSET NUMERIC_ROUNDABORT OFFSET CONCAT_NULL_YIELDS_NULL ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONCOMMITGOCREATE VIEW vw_MyViewWITH SCHEMABINDINGASSELECT Col1, Col2 FROM dbo.MyTable WHERECol2 IS NOT NULLGO/* --- end --- */and then added the constraint to the new view/* --- start --- */CREATE UNIQUE CLUSTERED INDEX AK_MyTable_Constraint1 ONvw_MyView(Col1, Col2)GO/* --- end --- */I thought we were doing fine, 'til we started running some DELETEstored procedures and got the above error. The error also citedARITHABORT as an incorrect setting until we ran this script:/* --- start --- */USE masterDECLARE @value intSELECT @value = value FROM syscurconfigsWHERE config = 1534SET @value = @value | 64EXEC sp_configure 'user options', @valueRECONFIGURE/* --- end --- */TIA to anyone kind enough to shed some light on this for me. Is theresomething we should have done differently in creating the view andindex? If not, what's the procedure for working through thesesettings errors?I've read through some other threads on this subject, but didn'treally find what I was looking for. Thanks again for any help. Wouldbe appreciated.-matt

View 3 Replies View Related

DELETE Failed Because The Following SET Options Have Incorrect Settings: 'QUOTED_IDENTIFIER'

Sep 20, 2006

When I want to delete a data from a table that this tabl has a triggerand this trigger reached another tables to delete the data in cursor Ihave this messeage:DELETE failed because the following SET options have incorrectsettings: 'QUOTED_IDENTIFIER'.My trigger :CREATE TRIGGER [TOPBASICIKISSILME] ON [dbo].[TBLDEPOBKTOPBASICIKIS]FOR DELETEASBEGINDECLARE @rows_affected int, @inc bigint , @dblid bigint ,@DEPOBKINCbigintSELECT @rows_affected = @@ROWCOUNTIF @rows_affected = 0RETURN -- No rows changed, exit triggerBEGINDECLARE Miktar CURSOR FORSELECT deleted.DBLID,deleted.TOPBASICIKISINC , deleted.DEPOBKINCFROM deletedOPEN MiktarFETCH NEXT FROM Miktar INTO @dblid,@inc,@DEPOBKINCWHILE @@fetch_status = 0BEGINSET QUOTED_IDENTIFIER ONDELETE FROM TBLDEPOBKMIKTAR WHERE DEPOBKINC=@DEPOBKINCAND OWNERINC = @inc AND ISLEMID=2 AND HAREKETID=19 AND BIRIM=1SET QUOTED_IDENTIFIER OFFPRINT @DEPOBKINCFETCH NEXT FROM Miktar INTO @dblid,@inc,@DEPOBKINCENDCLOSE MiktarDEALLOCATE MiktarENDEND

View 6 Replies View Related

Hm...can`t Understand, Please Help

Dec 27, 2004

i have this situations:

the aspx file with source code work good.
when i try run project which created from VS i take
"SQL Server does not exist or access denied."
connection strings same:

"Data Source=**.**.**.**,1433;Network Library=DBMSSOCN;Initial Catalog=slider;User ID=username;Password=password;"

i think may be it`s web.config in project wrong?

Edited by SomeNewKid
Removed username and password from connection string.

View 1 Replies View Related

Don't Understand

Aug 27, 2006

I am having a problem reinstall SQL Express 2005.  I had it installed, but then I unistalled it.  I have tried installing it again, but everytime I do it says that the product is already installed.  There is no instance of it in my Add/Remove Programs.  I have read the threads that relate to this topic, but they haven't helped.  I have looked at my logs of the installs, but they don't make sense neither.  I just want the program installed again, or a way to get it so that I can use it. 

When I try to manually uninstall using msiexec.exe /x <processid> I get an error saying that the package could not be opened.  This happens with all the process ids I use that I get from the log files (I have 11 logs).

 am using Visual Basic 2005 and trying to create a database, and it will not let me.  That is how I know that it is not installed, plus I can't find any instance of it one my computer.  Please help.  Thanks.

View 8 Replies View Related

I Need To Understand

Nov 19, 2006

How di I understand what SQL Server Integration Services mean? Can some one help me?

View 3 Replies View Related

Isn't Working... I Don't Understand?

Feb 23, 2008

I'm trying to put together a very simple page where you can click the up and down button to move the item up or down in the list and save the new list into the database. I've run the stored procedure... and it works so Its not a procedure problem. Here is the list in my databaseOrder_Id        Item         Position1                  Sebring     12                  GrandPrix  23                  Accord      44                  Miati         3 When I go to click the button I get a object reference not set to an instance of an object... This error haunts me many times. Heres the code to my project:BLL  /// <summary>
/// Gets Items from the Item table.
/// </summary>
/// <returns>A list of items.</returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public OrderItemDataSet.OrderItemDataTable GetItemDataByPosition()
{
return OrderItemAdapter.GetItemDataByPosition();
}

/// <summary>
/// Gets the order id based on the position specified.
/// </summary>
/// <returns>The order id.</returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
public int SelectOrderIdByPos(int pos)
{
return SelectOrderIdByPos(pos);
}

/// <summary>
/// Update Order list.
/// </summary>
/// <param name="newPos">Position to change to.</param>
/// <param name="originalPos">Original position.</param>
/// <param name="orderId">Original id.</param>
/// <param name="otherOrderId">Position to change id.</param>
/// <returns></returns>
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
public void ReorderItemByIdAndPosition(int newPos, int originalPos, int orderId, int otherOrderId)
{
OrderItemAdapter.ReorderItemByIdAndPosition(newPos, originalPos, orderId, otherOrderId);
}   Codebehind  1 using ReorderListWebApplication.BLL;
2 using System;
3 using System.Collections;
4 using System.Configuration;
5 using System.Data;
6 using System.Linq;
7 using System.Web;
8 using System.Web.Security;
9 using System.Web.UI;
10 using System.Web.UI.HtmlControls;
11 using System.Web.UI.WebControls;
12 using System.Web.UI.WebControls.WebParts;
13 using System.Xml.Linq;
14
15 namespace ReorderListWebApplication
16 {
17 public partial class _Default : System.Web.UI.Page
18 {
19 protected void Page_Load(object sender, EventArgs e)
20 {
21
22 }
23
24 protected void UpButton_OnClick(object sender, EventArgs e)
25 {
26 Label posLabel = (Label)ReorderItemDataList.FindControl("PosLabel");
27 Label idLabel = (Label)ReorderItemDataList.FindControl("IdLabel");
28
29 using (ReorderListWebApplication.BLL.OrderItem item = new ReorderListWebApplication.BLL.OrderItem())
30 {
31 int pos = 0;
32
33 pos = item.SelectOrderIdByPos(Convert.ToInt32(idLabel.Text) - 1);
34
35 // Grab other orderId!!
36 item.ReorderItemByIdAndPosition((Convert.ToInt32(posLabel.Text) - 1), Convert.ToInt32(posLabel.Text), 3, pos);
37 }
38 }
39
40 protected void DownButton_OnClick(object sender, EventArgs e)
41 {
42 using (ReorderListWebApplication.BLL.OrderItem item = new ReorderListWebApplication.BLL.OrderItem())
43 {
44
45 }
46 }
47 }
48 }
49
 

View 8 Replies View Related

I Don't Understand The Following Error....

May 2, 2008

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: You have specified that your update command compares all values on SqlDataSource 'SqlDataSource5', but the dictionary passed in for oldValues is empty.  Pass in a valid dictionary for update or change your mode to OverwriteChanges.
can somebody tell me what this is?
Angiemarie

View 3 Replies View Related

Don't Understand This Error

Oct 18, 2005

Hello, I could use some help with this error message:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
This if statement is the problem
IF (select bill_freq from #header1) = '1'   update #header1 Set     [Monthend] =  aa.pername    from sv00564 zz inner join sv00532 aa on zz.wennsoft_period_id = aa.wennsoft_period_id   Where zz.rmdnumwk like #header1.Invoice_Number

View 1 Replies View Related

Don't Understand Error...

May 4, 2006

This is failing:// Trying to update DynamicPageContent.Html where DynamicPageContent.PageID='121'//With// Select Html from DynamicPageHistory where HistoryID='831'//Update DynamicPageContentSET Html=(SELECT Html FROM DynamicPageHistory WHERE HistoryID='831')WHERE PageID='121'With the following error:Server: Msg 279, Level 16, State 3, Line 1The text, ntext, and image data types are invalid in this subquery or aggregate expression.DynamicPageContent.Html is Ntext size 16 and DynamicPageHistory.Html is Ntext size 16. PageID is and int and HistoryID is an int. It fails with single quotes around 831 and 121 and it fails without single quotes. The error message is the same both ways.Ideas?Thanks,Rex

View 4 Replies View Related

Starting To Understand

Jun 29, 2004

I feel extremly happy today and let me share with this wonderful forum why.

SQL is awesome and I'm really learning that theres alot of resources out there and coding is not that hard once you understand what your doing. Just took awhile for things to sink in. I still have a long ways to go but I'm really enjoying using sql. I practically live in our SQL Server 2000 at work and I'm learning more and more about it everyday.

Thank YOu so much guys I really appreciate all the help you've given me
Now I'm gonna study for the sql cert

:)

View 3 Replies View Related

Don't Understand GROUP BY...

Mar 8, 2005

I have a table Test_GUID, with fields id as int PK IDENTITY, GUID as varchar(50), and Version as tinyint. I put data in it such as

id GUID Version
------------------
1 abc 1
2 abc 2
3 def 1


Then I tried to get the following result:

id GUID Version
-------------------
1 abc 2
3 def 1

By using a query:

SELECT GUID, MAX(Version) AS MaxVersion, id
FROM dbo.Test_GUID
GROUP BY GUID

But then I get an error because id is not being aggregated.

This works

SELECT GUID, MAX(Version) AS MaxVersion
FROM dbo.Test_GUID
GROUP BY GUID

but then how do I get the id of each record?

View 2 Replies View Related

Help Me To Understand This SQL Sentence

Jul 18, 2006

Set @mSQL = 'SELECT Max([AccountID] + [ItemID] + [StorehouseID] + [BINID] + [LotItemID] + Convert(varchar(10),[BalDate],111)) AS [KEY],
AccountID, ItemID, StorehouseID, BINID, LotItemID INTO [xIV_tblStockSumLastDate' + ']
FROM IV_tblIVMaster
WHERE (BalDate<= 'Exec(@mSQL + '''' + @mtxtDate + '''' + ')
GROUP BY ItemID, AccountID, StorehouseID, BINID, LotItemID')

View 13 Replies View Related

Don't Understand The Error.

Oct 18, 2006

I'm doing code with VB.Net.

The error was:
System.FormatException: Input string was not in a correct format.


The line this is happening on is:
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")


I don't understand, it is giving that error particularly when I want to get ClientRepID

Some more lines from the code:
Response.Write("<TD><p>" + rdData("Username") + "</p></TD>")
Response.Write("<TD><p>" + rdData("ClientRepID") + "</p></td>")

The first line the compiler had no problem but when it gets to the second line with ClientRepID it gives me this error. (ClientRepID exists in the database)

Can someone please help me? Thanks

View 4 Replies View Related

I Don't Understand Licencing

Apr 19, 2007

Hello, i just bought sql server 2005 with 5 cals (previously i was using a shared sql server with my previous host)... I probably should have asked this question before i bought it... i don't understand how the cal licencing works... the sql server is for running our ecommerce site, i just got a dedicated server to put this on... but from reading the licencing does this mean that only 5 internet users can access my website(or the information in the database) at a time???

any help with this would be appreciated

~ Moe

View 4 Replies View Related

Trying To Understand Triggers

Jul 23, 2005

Hi,Newbie here. I have a mailing list program that I really like. I also have anew membership program. The membership program has mailing list signupsbuilt-in, but it isn't nearly as robust as the stand-alone mail program.If someone signs up for a newsletter when they register (membershipprogram), can a "trigger" in SQL Server put the same information into thestand-alone program's tables? And when they remove or update theirlists/info? And vice-versa?Is this what a "trigger" would do? And is it efficient?Thanks,JA

View 2 Replies View Related

SQL Backup - Dun Understand

Nov 23, 2005

Hi ,I am running SQL server 2000 sp3a and i have set up my database to be in"Full Recovery" mode.I am not able to understand if i have set anything wrong here :1. Full database Backup - every weekend2. Differential Backup - twice a day3. Txn log backup - 4 times a day (4hrs apart)Situation :my Txn Log file is now 18GB ,i can see it's only taking up around 1.5 GB ofactual space usedQues :i thought after every full database backup on each weekend, the txn logbackup will clear up the txn log , if so i see no reason why the txn log cangrow to 18 GB unless between the txn log backup , there's alot of data comingin that caused the txn log to grow but this is not the casekindly advise if my setup is wrong or what could have happened somwhere tocause the log to grow so muchtks & rdgs--Message posted via SQLMonster.comhttp://www.sqlmonster.com/Uwe/Forum...eneral/200511/1

View 2 Replies View Related

Primary Key: I Am Trying To Understand--please Help If You Can.

Jul 20, 2005

Hi all,So I've been reading the newsgroups, and reading a few books trying to learnSQL and SQL Server 2000. The books tell me I need a Primary Key, and thatevery table should have one. I know (I think) that a Primary Key is aspecial field that uniquely identifies each record or row within a table.My question is this: If I have a field or column whose values are all (andwill be) different in every row, is that what a Primary Key is, or is it nota primary key until I designate it as such with either a statement or byright-clicking a little key on the table diagram.If so, then what is the reason _behind_ why I have to do that, and have aprimary key?I've been playing with a few tables, and I can select information just fine,relate tables together with joins, and everything works fine (so far) allwithout my designating any Primary Keys--so why, exactly, do I need one, andexactly what is it?I would appreciate any help and clarification.Thanks.

View 4 Replies View Related

I Don´t Understand

Jun 23, 2006

i´m sorry my bad english

i have a dts in sql server 2005

for example in sql server 2000 i can do that :

over DTS right-clik choose option "Scheduled pachage" and this create a scheduled what i mean is that this produces a "JOB"

what i mean is that i need to know how can to create a scheduled to DTS´s in sql 2005

Please anyone of you provide some solution for this.

View 13 Replies View Related

Help With An Error I Don't Understand

Aug 31, 2007

Hey everyone,

I'm trying to make an image appear differently depending on the values of certain data. The statement that I am using is:

= IIF(DATEDIFF("dd",Fields!LastBackupDate.Value,Now)>15,"redball",IIF(DATEDIFF("dd",Fields!LastBackupDate.Value,Now)<8,"greenball","yellowball"))

And the error that I get is:


[rsRuntimeErrorInExpression] The Value expression for the image €˜image4€™ contains an error: Argument 'Interval' is not a valid value.

Preview complete -- 0 errors, 1 warnings

When I preview the report I just get the typical white box with a red x where the image should be. I don't understand.

Thanks in advance,
Keith

View 1 Replies View Related

Get Last Record, Of Many... Read To Understand

Mar 13, 2008

Ok,
I have a table with the following fields:
ID, Type, Name, Date, Description
ID is the PK. Names all have different values, but are predefined... a visual:
ID, Type, Name, Date, Description
1, monday, mon1234,3-3-08, some text
2, monday, mon1234,3-4-08, some text
3, monday, mon2345, 3-5-08, some text
4, monday, mon2345, 3-6-08, some text
 Now What i need to do is get the last report for each unique "Name". How would I do that?
When I try to do a Select Distinct, of course, it only gives me those names that only appear once.

View 3 Replies View Related

Simple Query Which I Am Not Able To Understand

Jun 13, 2008

 Hi,I have a float column in the database. When ever, I enter a value into the table, the values are rounded. Suppose I execute the following script: create table tblamount(    flttotal_amount    float)insert into tblamount values (0.00)insert into tblamount values (0.00)insert into tblamount values (0.00)insert into tblamount values (0.00)select * from #tblamount returns the following values:0000 but I want the ouput with the values 0.00 that I entered in the DB. Can u pls help me out with this? 

View 2 Replies View Related

Unable To Understand The YTD MDX Function

Dec 5, 2004

Hi,

Me and my thick skull :)

Couldn't get much help from books on-line and therefore can someone please helpme understand

the YTD function withan example maybe?

View 3 Replies View Related

Unable To Understand The Script ???

Apr 4, 2008

Hi,
i have a stored procedure as :
----------------------------------------------------------
CREATE PROCEDURE Insert_tblAccount
@Name varchar(50),
@Password varchar(20),
@StatusID int,
@AccountType int,
@DOI datetime,
@ROI varchar(500)
AS

Declare @NewID Numeric(18)

BEGIN

SET NOCOUNT ON

INSERT INTO [tblAccount](Name, [Password], StatusID,AccountType, DOI, ROI )
VALUES(@Name, @Password, @StatusID, @AccountType, @DOI, @ROI)

Set @NewID = SCOPE_IDENTITY()
Select @NewID As NewID
END
----------------------------------------------------------------

i could not understand the line
Select @NewID As NewID
bcoz i have learned that NewId() function returns unique identifier
but above code returns same value as SCOPE_IDENTITY.

So can anybody make me clear what's going on ?????

thanx in advance

San

View 2 Replies View Related

Don't Understand The Following Locking Behavior

Jul 23, 2005

can't figure out why the following locking scenario works the way itdoes:spid 1:start transactionselect a row from table T1 with updlockresult: see an Update lock for the row and index keyspid 2:query for the same row as in session 1result: the query succeedsspid 3:do same as spid 1result: blocks trying to get Update lock on the index key for rowNow I do the query again in spid 2 and it blocks trying to get a Sharedlock on the index key, and it's waiting for spid3. why was it able toget a shared lock on a index key that had an Update lock at first butthen can't get the same shared lock when somebody else is also tryingto get an update lock?

View 7 Replies View Related

I Don't Understand This Server Timeout

Feb 2, 2007

I was doing update statements in SQL Server 2000.I have a table with over 16 million rows.It came from several hundred delimited text files,and two of the columns are file ID (int) and Line # (int)Structure is X12 (835). For those unfamiliar with that,each file has one to many BPR lines; each BPR line haszero to many CLP lines, each of those has zero to manySVC lines, each of those has zero to many CAS lines.Working with this through the Enterprise Manager MMC,a lot of things I tried got timeouts.So, I indexed File ID, Line number, and line type, andcreated a new table containing only the columns I knewI would need in the final output--selected fields fromsome of the line types mentioned, plus the line numbersand common file ID for those rows.I indexed every column in that table that I thought I mightsearch on.I loaded it with 31 thousand rows using a select on asubset of the CAS rows. That took far less than a minute.I updated each row with the highest BPR line number not higherthan the CASE line number. About a minute. Not bad, with havingthe worst case number of comparisons being 16 million times 31 thousand.Of course, the indexing should help plus it can be narrowed down bythe "same file" and BPR # < CAS # criteria.But the next update should theoretically be faster: each row now hasa BPR # and a CAS # and I am telling it to find the highest CLP numberBETWEEN those two. So it should have a MUCH smaller set of to searchthrough. Yet it thinks for about five minutes and then announces a timeout.Any suggestions?--Wes GroleauMeasure with a micrometer, mark with chalk, and cut with an axe.

View 20 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved