Forum Replies Created

Viewing 15 posts - 1,306 through 1,320 (of 2,007 total)

  • RE: help with multi-path hierarchical data

    Fixed your sample data so that it actually works -

    CREATE TABLE [dbo].[Devices](

    [ID] [int] NOT NULL,

    [DeviceName] [varchar](50) NOT NULL,

    [DeviceType] [varchar](20) NOT NULL,

    [Description] [varchar](255) NULL,

    CONSTRAINT [PK_Devices] PRIMARY KEY CLUSTERED ([ID] ASC)

    )

    CREATE...

  • RE: Transpose data

    No problem. Hell, if you're really lucky then one of the others that knows a bit more about PIVOT will happen by with a better solution 😀

  • RE: nested sql statement

    Formatted for sanity!!

    SELECT DATEADD([hour], DATEDIFF([hour], 0, SCAN_ASSEMBLED_DATE), 0) AS DATETY,

    COUNT(PROD_ASSEMBLY_BARCODES.MATERIAL_ID) AS QTY, '***' AS TYPE,

    CASE WHEN [STK_PRODUCTION_LINE] = 'F'

    THEN 'N'

    WHEN...

  • RE: Transpose data

    squidder11 (11/22/2011)


    This is what I have so far, how do I get more than one row of data in the results

    BEGIN TRAN

    SET NOCOUNT ON

    CREATE TABLE #TemplateDictionary(

    [TMPL_OBJECT_NAME] [nvarchar](100) NOT NULL,

    [FieldName] [nvarchar](100)...

  • RE: Better way to do a query

    Yeah, no-one is going to download a zip file on a programming website 😉

    Attach them as text files

  • RE: Transpose data

    squidder11 (11/22/2011)


    Thanks Cadavre - that produces exactly the results I asked for, but I guess I maybe simplified my question too much.

    The problem I have is that No. of rows...

  • RE: Better way to do a query

    BinaryDigit (11/22/2011)


    Hi

    I have a query that looks like this

    declare @temp table(Lat smallint, Long smallint, vesselCount int)

    INSERT INTO @temp

    SELECT Latitude, Longitude, dbo.GetZoneBlockCount(Latitude, Longitude)

    FROM ZoneBlocks WITH (NOLOCK)

    UPDATE ZoneBlocks

    SET VesselCount =...

  • RE: [Just For Laugh] Why only 2 Cents?

    Repost.

    Probably should have just asked Steve to move the original (when he gets back) if you thought it was better suited here.

  • RE: Transpose data

    This is probably not the best way to go about it, I'm not good with PIVOT/UNPIVOT because I feel that this sort of job is better done in the presentation...

  • RE: MCDBA certification

    Ninja's_RGR'us (11/21/2011)


    ... does that include learning material and time??

    Didn't think so :-D.

    Of course not! 🙂

    Ninja's_RGR'us (11/21/2011)


    The real question is all that worth it for you? It may or not....

  • RE: MCDBA certification

    Dev (11/21/2011)


    Ninja's_RGR'us (11/21/2011)


    Dev (11/21/2011)


    The only certif I give any credit to is MCM or MCA if it ever becomes available to the public (sorry if I'm...

  • RE: Calculate the number of sick days in each month over a number of months

    Ninja's_RGR'us (11/21/2011)


    @cadavre

    What about week-ends, holidays and non-production days?

    You don't realllllllllly want to work 365 days / year, do you? 😉

    I did write "Your question is flawed".

    Either way,...

  • RE: Calculate the number of sick days in each month over a number of months

    steve-433846 (11/21/2011)


    I am trying to work out how many days a person has had off sick in each month

    quite easy when the sickness is just in one month, can anyone...

  • RE: Dynamic Date (Best thing I can think to describe it)

    This gives you 82,138 dates and is correct for leap-years.

    IF object_id('tempdb..#testBillingPeriods') IS NOT NULL

    BEGIN

    DROP TABLE #testBillingPeriods

    END

    SELECT IDENTITY(INT,1,1) AS ID,

    startFirstMonth, startMidMonth, finishMidMonth, finishEndMonth

    INTO #testBillingPeriods

    FROM (SELECT TOP...

  • RE: Multi column Pivot

    Please don't use a CURSOR.

    I'm not particularly good with PIVOT, mainly because I think that pivoting of data should occur in the presentation layer rather than the database. So...

Viewing 15 posts - 1,306 through 1,320 (of 2,007 total)