Forum Replies Created

Viewing 15 posts - 3,376 through 3,390 (of 8,731 total)

  • RE: Syntax Help Please

    Avoid using UNION when you don't want to eliminate duplicates. It's additional work which might generate unexpected results.

    Use UNION ALL when you only want to get two sets of data...

  • RE: Load text file to multiple tables in SQL server

    Jeff Moden (2/8/2016)


    mxy (2/8/2016)


    Thanks it worked let me work on first set of data in the file.

    Thanks again for your time.

    How? When I try to load the file with...

  • RE: Building DATETIME from two strings

    Johnny B (2/8/2016)


    36 hour day... really?

    Sound like a normal day in my previous job. 😀

  • RE: need help to write a query

    patla4u (2/8/2016)


    SELECT o.*,

    COALESCE( NULLIF(o.t_wght, 0), x.t_wght, 0)

    FROM [TBRTEK002] o

    OUTER APPLY (

    SELECT TOP 1 max(i.t_wght)...

  • RE: calculate total salary based on employee type

    This should work the same way as the code from Jacob. This is the deprecated syntax.

    DECLARE @startDateTime DATETIME = '2015-11-01 00:00:00';

    DECLARE @endDateTime DATETIME = '2016-02-28 23:59:59';

    WITH Sales AS

    (

    SELECT sales_amount=SUM(AMOUNT),...

  • RE: Load text file to multiple tables in SQL server

    Trust me, it works the way I posted it with the data file as you posted it.

    The first row option doesn't really count rows as you might expect, it counts...

  • RE: need help to write a query

    patla4u (2/8/2016)


    I understood the query but I am not able to return the result. I tried my best to get result. Please help me.

    Post what you've tried.

  • RE: need help to write a query

    Of course it's not working, I made it carry over the weight if the shifts are on the same day. If you are able to understand the query, the correction...

  • RE: Load text file to multiple tables in SQL server

    Your format file is wrong. You should define the format file according to the data file and map those columns to the table, not the other way around.

    10.0

    10

    1 ...

  • RE: need help to write a query

    Here's a 2008 friendly option.

    SELECT o.*,

    COALESCE( NULLIF( o.t_wght, 0), x.t_wght, 0)

    FROM [TBRTEK002] o

    OUTER APPLY (

    ...

  • RE: need help to write a query

    patla4u (2/8/2016)


    I am using 2008 R2 and I am not able to run above query. I am sorry.

    And why do you post in the 2014 forum? :angry:

  • RE: need help to write a query

    One way to do it. Assuming I understand correctly.

    SELECT *,

    COALESCE( NULLIF( t_wght, 0),

    NULLIF(...

  • RE: calculate total salary based on employee type

    Is it that hard to post the code here?

    create table Employees_View

    (

    ID int,

    Name varchar(50),

    PayRate float,

    PayUnitCode varchar(2),

    Commission float

    )

    insert Employees_View values

    (1, 'James', 10,...

  • RE: need help to write a query

    You provided 276 rows of data. Are you expecting people to check correctness for all those rows? What would be the expected results?

    CREATE TABLE [dbo].[TBRTEK002](

    [t_mcno] [char](6) NULL,

    [t_citg] [char](6) NULL,

    [t_trdt] [datetime]...

  • RE: Query on Using DB Snapshots

    DB Snapshots use the database as the main source of data and only store pages that get modified. That means that querying against the snapshot is probably going to impact...

Viewing 15 posts - 3,376 through 3,390 (of 8,731 total)