Viewing 15 posts - 181 through 195 (of 274 total)
If the string you want is always the next-to-last one and is always delimited by '/', this should do it:
SELECT
SUBSTRING(data, LEN(data) - CHARINDEX('/', REVERSE(data), CHARINDEX('/',...
June 23, 2010 at 12:30 pm
But be careful with BETWEEN, since it is inclusive on both ends.
If you say between Jan 1 and Feb 1 00:00:00.000, attempting to get Jan, you could get some from...
June 23, 2010 at 8:16 am
If you don't need the identity column, or any other non-grouped data, I think you can do it all in one step, like so:
...
June 23, 2010 at 8:15 am
For performance reasons, you should always avoid manipulating the table columns if at all possible. For example, for the dates, do not do this ever:
... (convert(char(10), email_dt, 121) >=...
June 23, 2010 at 7:56 am
FYI, I was talking about a separate table from AuditTypes, basically an AuditTypesControl table.
June 22, 2010 at 4:43 pm
For maximum flexibility, create another table with:
CheckAuditor, AuditTypeId
Then INNER JOIN to that table to limit what any CheckAuditor can see.
Something like this:
INSERT INTO CheckAuditor (CheckAuditor, AuditTypeId)
SELECT 0, 1 UNION ALL
SELECT...
June 22, 2010 at 1:34 pm
You can get around the security issue by using sp_altermessage, but that means *every* occurence of the message will be logged.
You might be able to get around that by altering...
June 22, 2010 at 1:26 pm
Of course the real answer, as always, is "it depends".
If the parameters will match only a single value on the db, it makes sense to use the same plan for...
June 22, 2010 at 1:18 pm
Do you mean that fixed literals force a recompile, while variables force a plan reuse?
Only specifying WITH RECOMPILE or equivalent can force a recompile. AFAIK, there is nothing you...
June 22, 2010 at 12:56 pm
To avoid having to check for a previous WHERE for every condition, you can use the old trick of coding the original statement with:
WHERE 1 = 1
so that all conditions...
June 22, 2010 at 10:26 am
And worse off yet is if microsoft were to change the reference date to one that started on anything else other than a monday, you would have to modify your...
June 21, 2010 at 2:59 pm
Your current date comparisons are faulty. The month and day do not have to exceed the from date for the date to be valid for selection.
For example:
from date =...
June 21, 2010 at 12:27 pm
Why do you need to limit the note to 255? SQL can obvioulsy handle much more than that.
Is that some type of output restriction?
If so, I would still store...
June 21, 2010 at 9:49 am
It's interesting. I thought the requestor was interested in time-of-day across any number of days, rather than just on one 24-hr period.
For example, for the last, say, 2 weeks,...
June 21, 2010 at 7:50 am
Also be sure to truncate the @StartTime (of the reporting period) passed in down to the even hour, or you would get a totally incorrect result.
June 18, 2010 at 5:23 pm
Viewing 15 posts - 181 through 195 (of 274 total)