Viewing 15 posts - 8,026 through 8,040 (of 8,416 total)
Lynn,
Don't get me wrong - I am sure that the NOT EXISTS solution is fine for all general purposes, and it is very similar to the approach I would take.
Nevertheless,...
May 8, 2009 at 10:35 am
Apologies if I am spamming here :hehe:
Lynn, yes Jamie did mention SERIALIZABLE - but he said he had looked at it and didn't think it met his requirements (:confused:)
Paul
May 8, 2009 at 10:23 am
Steve Jones - Editor (5/8/2009)
I still think the best thing is to run the insert, then...
May 8, 2009 at 10:20 am
Lynn Pettis (5/8/2009)
At this point, we actually don't know...
May 8, 2009 at 10:11 am
As an aside, and for general amusement rather than as a serious proposal, note that the following will ensure that an error is raised if you try to assign more...
May 8, 2009 at 10:03 am
Bob Hovious (5/7/2009)
Jamie, are you thinking that you have to somehow code the locks yourself?
Jamie,
At the same time as *not* necessarily recommending this as a solution in this case, there...
May 8, 2009 at 9:52 am
For clarity, note that Bob's example also fails if READ_COMMITTED_SNAPSHOT is on.
May 8, 2009 at 9:48 am
Florian Reischl (5/6/2009)
HiWhat about just a simple INSERT SELECT WHERE:
INSERT INTO dbo.Users
SELECT @UserId
WHERE NOT EXISTS (SELECT TOP(1) 1 FROM dbo.Users WHERE Id = @UserId)
Bob, Lynn, Flo, Steve and Bruce:
{warning, devil's...
May 8, 2009 at 9:39 am
FWIW, I tend to use SELECT the vast majority of the time.
It's more a question of style than substance.
Go with whatever makes you happiest.
Paul
May 7, 2009 at 5:58 am
It will be easier to show you what is happening, if you can provide the CREATE TABLE statements for each of the tables you reference.
The data for the tables isn't...
May 7, 2009 at 5:51 am
Ratheesh.K.Nair (5/7/2009)
What is Lazy writer?
The author of a lazy post...?
:laugh:
Paul
May 7, 2009 at 5:29 am
So much for me leaving it as an exercise for the OP then!
May 5, 2009 at 9:17 am
Lynn Pettis (5/5/2009)
Then you have those that would bite the hand that is trying to feed them.
Are you sure he was shouting deliberately?
His posts seemed quite amiable up to that...
May 5, 2009 at 7:13 am
That link is for SQL 2008, this is the 2005 one:
http://msdn.microsoft.com/en-us/library/ms190422(SQL.90).aspx
INSERT...SELECT can be minimally logged in 2008 only - and only if the table is a heap (no clustered index).
Paul
May 5, 2009 at 7:06 am
tobe_ha (5/5/2009)
INSERT INTO...SELECT into a table with a clustered index can still be minimally logged, unless it contained rows before the INSERT, in which case it will be fully logged...
May 5, 2009 at 7:01 am
Viewing 15 posts - 8,026 through 8,040 (of 8,416 total)