Viewing 15 posts - 7,456 through 7,470 (of 7,602 total)
I wouldn't automatically add a leading %. That forces a full scan which is often unnecessary if the requestor knows what the first name starts with.
Instead, allow the user...
March 15, 2012 at 12:52 pm
You should be able to update all rows at once, like so:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[tr_TaxID]
ON [dbo].[Item]
after INSERT, UPDATE AS
UPDATE [dbo].[Item]
SET
taxid...
March 12, 2012 at 8:55 am
I would just use a CASE statement.
But you raised a good point I overlooked.
If you do need only current year's data, I should have added a WHERE clause with a...
March 8, 2012 at 3:23 pm
SELECT
name,
SUM(CASE WHEN date_column >= CAST(YEAR(GETDATE()) AS char(4)) + '0101'
THEN total ELSE 0...
March 8, 2012 at 2:34 pm
Not 100% sure, don't think it's a lot longer. Neither one is very fast really rebuilding 🙂 .
February 29, 2012 at 8:15 am
For (almost) pure reads, as O/S and SQL pgms are, RAID5 should be faster than RAID10, with the same number of spindles for each RAID.
So, I'd say use...
February 28, 2012 at 4:18 pm
An UPDATE statement will always cause some type of lock(s) on the table. SQL must do locks to insure the integrity of the UPDATEs.
Depending on the number of rows...
February 22, 2012 at 1:47 pm
If I understand correctly:
((COALESCE([prefix]+'-'), '')+right('0000'+COALESCE(convert([varchar],[numeric],(0)), ''),(4)))
is persisted =yes
February 22, 2012 at 1:39 pm
For XML data, you are very likely better off specifying XML as the data type rather than varchar(max), since SQL optimizes XML storage.
February 20, 2012 at 2:13 pm
When did SQL Server start doing these "auto sorts" for clus indexes?
February 16, 2012 at 8:12 am
I wouldn't call it 'auto-magically',
That's primarily what I meant. I thought it was conditional. I've seen SQL not do it.
To me it's much safer to code your...
February 15, 2012 at 4:33 pm
I thought it depended on whether SQL thought it was "necessary" or not.
Whether the number of rows, etc., met whatever magic criteria SQL went by -- which are not documented...
February 15, 2012 at 12:52 pm
IIRC, a single insert of many rows will be done in the clustered index order auto-magically.
Really? Interesting. I don't recall that. Would be nice tho.
February 15, 2012 at 12:35 pm
I think the order does matter for the clus index and whether it gets fragmented or not. SQL is coded to recognize sequential inserts and not cause page splits...
February 15, 2012 at 7:52 am
Very interesting post by Conor.
I referred to the clus index only. I assumed you can't control any other index(es), nor a heap (the ORDER BY would be irrelevant to...
February 14, 2012 at 1:46 pm
Viewing 15 posts - 7,456 through 7,470 (of 7,602 total)