Viewing 15 posts - 6,466 through 6,480 (of 7,600 total)
Hmm, interesting. SQL's still "dumber" than I thought :-).
We'll need to UNION the query results instead of using "OR".
Also, as always, we want the variable to be exactly the...
August 9, 2013 at 12:24 pm
You might want to allow for no comma being in the string (just in case).
And you can remove some unnecessary elements from the code:
SELECT CAST(LEFT(@buyer, CHARINDEX(',', @buyer + ',') -...
August 9, 2013 at 9:54 am
You don't need separate indexes on StartDateTime and EndDateTime, you need them in the same index.
SQL will only be able to do a seek on that index if it's headed...
August 9, 2013 at 9:26 am
Stefan_G (8/9/2013)
I also get both years in a single SELECT to (try to) avoid double-reading of the tables.
Unfortunately your code will read all data for all invoices from 1 year...
August 9, 2013 at 8:33 am
Here's my version of it. I delayed the lookup of CustomerName to avoid having to GROUP on it -- GROUP BY is an especially expensive operation on varchar columns.
I...
August 8, 2013 at 4:14 pm
I had detached a SolarWinds database called NetPerfMon that consisted of three data (mdf) files and one log(ldf) file.
That might be the problem. Detaching a db in SQL...
August 8, 2013 at 3:39 pm
I prefer a "template" approach. I find it much easier to write, follow and maintain. For example:
DECLARE @backupcommand_template varchar(8000)
DECLARE @backupcommand varchar(8000)
SET @backupcommand_template = '
BACKUP DATABASE [$db$]
TO DISK =...
August 8, 2013 at 10:54 am
Do you really need only the TestId column in the result set? You don't all the columns?
August 7, 2013 at 4:06 pm
If you start a single transaction before the loop begins (or, more awkwardly, only on the first loop), then any rollback will rollback all activity for that transaction. If...
August 7, 2013 at 3:59 pm
CTEs do not do that, from what I've seen looking at query plans. Instead, SQL re-runs the entire query every time you refer to the CTE.
For the most performance...
August 7, 2013 at 1:36 pm
Yes, it's possible; I've done it several times. In fact, you don't even have to pass in the db name -- the proc will automatically run in the current...
August 7, 2013 at 1:31 pm
code goes on to split the logic path based on @RecordCount = 0 vs. @RecordCount > 0.
You shouldn't do a full count of the table for that either, btw; use...
August 6, 2013 at 2:54 pm
mister.magoo (8/5/2013)
Amy.G (8/5/2013)
SELECT column1, column2
INTO NewTable
FROM OldTable
method. Is there a way of creating a table in this manner and saying if the columns...
August 6, 2013 at 2:45 pm
Agreed, a trigger is not at all the best place for this type of thing.
RECONFIGURE is not allowed to be part of a transaction. A modification trigger is inherently...
August 6, 2013 at 2:38 pm
The function below will return the job_id when you pass in the string with the "Job 0x...." (I've since discovered a perhaps better way, but can't find that code right...
August 2, 2013 at 2:29 pm
Viewing 15 posts - 6,466 through 6,480 (of 7,600 total)