Forum Replies Created

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

  • RE: Convert date to MMDDYYYY

    micang (2/10/2016)


    Orlando Colamatteo (2/9/2016)


    The performance of FORMAT is very poor when used over large sets of data which is unfortunate because the syntax is more readable than any of the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Building DATETIME from two strings

    Johnny B (2/8/2016)


    36 hour day... really?

    Sound like a normal day in my previous job. 😀

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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),...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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 ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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 (

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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:

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: need help to write a query

    One way to do it. Assuming I understand correctly.

    SELECT *,

    COALESCE( NULLIF( t_wght, 0),

    NULLIF(...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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]...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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