Viewing 15 posts - 151 through 165 (of 274 total)
USE yourDb
ALTER yourDb
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
USE master
EXEC sp_detach 'yourDb'
July 6, 2010 at 4:28 pm
I admit I just do these when I'm taking a quick break. I have so much work to do right now I just don't have even break time right...
July 6, 2010 at 1:12 pm
If by "run it for Tuesday", then you mean "ignore Wednesday's" rows in the query, then no, it still won't, because the count of clock-in will not match the count...
July 6, 2010 at 12:05 pm
Yes, you can "trick" it my making up a logout time occuring before the login time. In real life, that WON'T happen. Time is linear. You CANNOT...
July 6, 2010 at 11:42 am
That would have NO effect on my query. As long as the proper pairs were present.
I've done this before on time systems. You really don't have to pass...
July 6, 2010 at 10:46 am
You will see that your query will return strange results as to make it work, COUNT should be changed to SUM in the HAVING clause.
Yes, SUM() should be used in...
July 6, 2010 at 7:52 am
For the emps with matching in/out and pause/resume rows [and presumably you edit for those who don't match up], you don't have to go thru all that.
select EMPID, cast(WorkMins /...
July 3, 2010 at 11:20 pm
If you data contains the actual month name, maybe you could do this within the CTE, as posted by Mike01:
...
PARTITION BY Code ORDER BY Code, CHARINDEX(data, 'JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember') ...
July 1, 2010 at 12:29 pm
Actually, no, if the result was an exact number of years, I kinda' figured he wouldn't add one to that. But that was just my own best guess, of...
June 29, 2010 at 5:57 pm
Wouldn't it just be something like this?:
select cust_num,
SUM(case site when '11099' then sales_ytd else 0 end) as [11099_sales_ytd]
, SUM(case site when '11101' then...
June 29, 2010 at 3:54 pm
Add 1 to the DATEDIFF() unless the dates are equivalent.
SELECT DATEDIFF(YEAR, date1, date2) + CASE WHEN CONVERT(CHAR(5), date1, 1) = CONVERT(CHAR(5), date2, 1) THEN 0 ELSE 1 END
You have to...
June 29, 2010 at 3:41 pm
So, the inline CTE has better performance than a tally table? Interesting. Sometimes SQL's performance traits are a bit quirky.
June 29, 2010 at 3:38 pm
True enough; and I saw the other link, which is identical to your method.
June 29, 2010 at 3:28 pm
For sure nothing will touch the performance of C#/C++ for that type of function.
For use on a table, you would probably need a scalar function, and those don't perform that...
June 29, 2010 at 3:25 pm
The UPDATE below will replace the first occurence of -- and any number more dashes in a row, with a single space.
Since you have multiple occurences within the string, you...
June 29, 2010 at 1:57 pm
Viewing 15 posts - 151 through 165 (of 274 total)