Forum Replies Created

Viewing 15 posts - 556 through 570 (of 627 total)

  • RE: Seconds to AM/PM Time

    You could do something like this. Just be mindful if you have any values that exceeds 24hrs (in seconds).

    DECLARE @seconds INT

    SET @seconds = 24331

    IF @seconds < 43200

    SELECT CAST(@seconds/3600 AS...

  • RE: Queries running against to a table

    You have a few options.

    1. Setup a trace using profiler

    2. Extended Events (I'm assuming your using 2008)

    3. You can get some limited stats from DMV's i.e. sys.dm_exec_query_stats

    Cheers,

  • RE: SQL Server Jobs schedule

    Just threw this together quickly so take it as you will but it might help with what you are looking for.

    USE [MSDB];

    WITH Last_Run AS

    (

    SELECT MAX(instance_id) AS maxID, job_id FROM sysjobhistory...

  • RE: Can anyone help group this query result? Thanks.

    halifaxdal (6/4/2015)


    yb751 (6/4/2015)


    Sounds like you just need to use PIVOT...can't be 100% sure though without some sample data/output.

    Thanks, never used pivot before, can you help?

    If it is indeed what you...

  • RE: Can anyone help group this query result? Thanks.

    Sounds like you just need to use PIVOT...can't be 100% sure though without some sample data/output.

  • RE: Finding the tree structure

    This is just a shot at the dark here because I'm still not exactly sure what you want. The output is a little different but I built it based...

  • RE: Declared Hard coded Variables

    patelxx (6/3/2015)


    declare @StartTime nvarchar(10)= '12:00'

    declare @EndTime nvarchar(10)= '12:45'

    declare @Diff time(1) = cast(@EndTime as datetime) - cast(@StartTime as datetime)

    How to I use Column names instead of Hard coding variables - e.g....

  • RE: Returned value of a stored prcedure

    I'm not sure if you realized but Lynn was being quite literal. Open up your procedure and just do a Ctrl-F and look for any RETURN statements. Often...

  • RE: I need help with this query.

    Since you are completely new to the site I'll throw you a bone. 😉

    Just for future reference people here are very helpful and always ready to help. However, like...

  • RE: Load data for yesterday's date and specific date

    Well I'm no SSIS expert but assuming you have a stored procedure as your data source you could do something like this.

    CREATE PROCEDURE DefaultTest

    @date_param DATETIME = NULL

    AS

    SET NOCOUNT ON

    DECLARE @date...

  • RE: Duplicate Index...or am I missing something?

    Hmmm, I hadn't considered that. I have 17 columns and looking at the data types only one raises an eyebrow which is a LOB used to store images.

  • RE: Compare this years data with last years data - day adjusted

    It's much easier to visualize with data.

    Try this for example:

    DECLARE @test-2 TABLE(myDate DATE, Sales MONEY)

    INSERT INTO @test-2(myDate, Sales)

    VALUES

    ('12/30/2013',100),

    ('12/31/2013',100),

    ('01/01/2014',100),

    ('01/02/2014',100),

    ('01/03/2014',200),

    ('01/04/2014',200),

    ('01/05/2014',100),

    ('01/06/2014',100),

    ('01/07/2014',100),

    ('01/08/2014',100),

    ('01/09/2014',100),

    ('01/10/2014',250),

    ('01/11/2014',250),

    ('01/01/2015',100),

    ('01/02/2015',150),

    ('01/03/2015',150),

    ('01/04/2015',100),

    ('01/05/2015',100),

    ('01/06/2015',100),

    ('01/07/2015',100),

    ('01/08/2015',100),

    ('01/09/2015',300),

    ('01/10/2015',300)

    SELECT *, DATEPART(dw, myDate) AS Day_Week, DATEPART(isowk, myDate)...

  • RE: to find equal and opposite rows in a table

    Could you further explain why C is eliminated from your desired output? In fact we could use a little more info in general. Without knowing how A is...

  • RE: Select quert with REPLACE function

    Despite your description being vague I 'think' I know what you want.

    If the cities need to be known by different names then you are best to just create a table...

  • RE: You know you're having a slow day when...

    Brandie Tarvin (5/11/2015)


    You should turn that into an article, if you haven't already. Lots of people would be interested in your journey.

    I hadn't thought of that. It's a good...

Viewing 15 posts - 556 through 570 (of 627 total)