Forum Replies Created

Viewing 15 posts - 481 through 495 (of 617 total)

  • RE: how to classify records based on time intervals

    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.

  • RE: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    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...

  • RE: copy Sql Trace into a table

    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...

  • RE: SA versus DBA

    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...

  • RE: Running multiple instances of the same procedure

    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. ...

  • RE: SQL Statements Using joins and the TOP keyword

    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...

  • RE: JOIN on table with TOP 1

    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. ...

  • RE: SQL Statements Using joins and the TOP keyword

    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...

  • RE: "ALTER TRACE" permission

    Best I can tell it is a server level permission.

  • RE: Recursive Select Statement

    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...

  • RE: Subquery

    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'

    ...

  • RE: SQL SERVER 2005

    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...

  • RE: Execute Function for Selected Rows In A Table

    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...

  • RE: Dynamic Data Format Validation

    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...

  • RE: T-SQL to generate create table script?

    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...

Viewing 15 posts - 481 through 495 (of 617 total)