Viewing 15 posts - 6,466 through 6,480 (of 7,597 total)
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
First, you have to be careful with terminology in SQL Server -- a login and a user are not the same thing.
The login is at the server level, the user...
August 2, 2013 at 2:22 pm
Yeah, that's crazy.
Is there any way you can "spoof" the database id so it can be something else in the real server but report back to the software what it...
August 2, 2013 at 2:13 pm
Luis Cazares (8/1/2013)
http://www.sqlservercentral.com/articles/T-SQL/88244/
SELECT AttribID
FROM MyTable
WHERE FormatID IN (12,15)
GROUP BY AttribID
HAVING COUNT(DISTINCT FormatID ) = 2
EXCEPT
SELECT...
August 1, 2013 at 3:21 pm
Viewing 15 posts - 6,466 through 6,480 (of 7,597 total)