Viewing 15 posts - 481 through 495 (of 617 total)
Use a case and datepart.
select case when datepart(hh,getdate()) between 6 and 11 then 'morning'
WHEN datepart(hh,getdate()) = 12 THEN 'noon'
WHEN datepart(hh,getdate()) BETWEEN 13 and 17 THEN 'afternoon'
end
etc.
November 26, 2007 at 3:33 pm
Best I can do is give you some places to look I'm afraid.
1) Get your execution plan from your dev/test boxes and compare it to the prod...
November 26, 2007 at 3:28 pm
INSERT INTO tblTrace SELECT * FROM ::fn_trace_gettable("c:\mytrace\test.trc")
This statement should append the data in the test.trc into tblTrace each time you run it just like a normal insert. Now it...
November 26, 2007 at 3:18 pm
At my company we (the DBAs) just took over a lot of the responsibility from the SA's for our SQL boxes. Primarily because they are seriously under staffed and...
November 21, 2007 at 1:55 pm
What kind of problems did you run into with Service Broker? I would much prefer to hear about them from you than have to run into them myself. ...
November 21, 2007 at 1:45 pm
Honestly I'm not sure why if its listed last in the plan it behaves the way it does but it does seem to seriously reduce the amount of time on...
November 20, 2007 at 7:04 am
Your problem is that you arn't linking your subquery to your outer query. Your inner query is returning exactly 1 record. The top record in the table. ...
November 19, 2007 at 3:27 pm
Well, Its not exactly a free lunch but it does help some. If you use a top 100 SQL will stop running after it finds the first 100 matches...
November 19, 2007 at 3:17 pm
Best I can tell it is a server level permission.
November 19, 2007 at 3:13 pm
The method you are using is fine. You just have one small piece of the puzzle missing.
Select c.[ConsultantID]
,c.[FirstName]
,c.[LastName]
,c.[SponsorID]
,d.[FirstName] AS Sponser_FirstName
,d.[LastName] AS Sponser_LastName
from Consultant C, Consultant D
Where C.SponsorID...
November 19, 2007 at 3:07 pm
Simple enough. Just add a reference from your outer query into your subquery. For example:
SELECT OuterQuery.*
FROM OuterQuery
WHERE EXISTS
(
SELECT jobs.job_id, Min(opactivity.id) As 'OptID'
...
November 19, 2007 at 1:50 pm
I agree with Grant. You definatly need to provide some more information but here is a very general response
[Quote]
Please list customers that are currently on Plan C but they...
November 16, 2007 at 3:51 pm
Well normally you would just call the function in the field list of a query.
SELECT fn_Function(FieldA)
FROM Table1
WHERE FieldA IS NOT NULL
Normally you are just trying to get data back but...
November 16, 2007 at 3:42 pm
Well here is a start. Unfortunatly I could only get it to work as a procedure not a function (where it would be much more useful) but maybe with...
November 15, 2007 at 3:09 pm
Any reason you don't want to use the GUI to do the scripting? If you right click on the database name and select Tasks\Generate Scripts you will be in...
November 15, 2007 at 2:46 pm
Viewing 15 posts - 481 through 495 (of 617 total)