Forum Replies Created

Viewing 15 posts - 2,956 through 2,970 (of 10,144 total)

  • RE: Can a JOIN be used here instead of a UNION?

    david.dartnell (9/3/2014)


    Hi ChrisM@Work,

    Thank you for your suggestions. I have now managed to find the line in my query which is returning NULL values.

    (T0.TotalSales - T0.StockValue) / NULLIF(T0.StockValue, 0) AS 'Gross...

  • RE: Estimated rows are more than actual rows in execution plan

    kbhanu15 (9/3/2014)


    hi All,

    can you please provide me some suggestion how to avoid this conflict.

    estimated rows are greater than actual rows.

    and also please provide some tuning tips for this procedure.

    please find...

  • RE: Problem when pass parameters on Query

    Hi Luis

    Spot on - split the comma-delimited list into a table. The function looks horribly slow though, I'd recommend you switch to the SSC function which is linked in the...

  • RE: SQL Help

    sunitha.yanagandala (9/3/2014)


    select * from

    (

    select ROW_NUMBER()over(Partition by coveragecode) rowno,* from Contract

    )t

    where rowno<=5

    Msg 4112, Level 15, State 1, Line 1

    The function 'row_number' must have an OVER clause with ORDER BY.

    A version...

  • RE: Problem when pass parameters on Query

    luissantos (9/3/2014)


    Hello comunity

    I solve the problem.

    Many thanks

    Luis Santos

    Hi Luis

    Can you post up the solution you are using? I'm sorry your thread went a little off-track. Luis' suggestion should work just...

  • RE: can be recursive too ?

    Adi Cohn-120898 (9/3/2014)


    You can do it also with an Inner Join:

    create table #MasterDates (D DATE)

    go

    insert into #MasterDates (D) VALUES

    ('2014-08-01'),

    ('2014-08-02'),

    ('2014-08-03'),

    ('2014-08-04'),

    ('2014-08-05'),

    ('2014-08-07'),

    ('2014-08-09')

    go

    create table #Employees (EmployeeID char(6), StartDate date, EndDate date)

    go

    INSERT INTO #Employees (EmployeeID,...

  • RE: Calculate gregorian easter sunday using a table valued function

    Faster than the usual algorithm I use. Here's a little tidyup:

    ;WITH

    Step1 AS( SELECT a = @year%19, b = FLOOR(1.0*@year/100), c = @year%100),

    Step2...

  • RE: can be recursive too ?

    DROP TABLE #Represent

    CREATE TABLE #Represent (EmployeeID INT, StartDate DATE, EndDate DATE)

    INSERT INTO #Represent (EmployeeID, StartDate, EndDate)

    SELECT 003505, '2014-08-01', '2014-08-02' UNION ALL

    SELECT 003505, '2014-08-04', '2014-08-09'

    DROP TABLE #MasterDate

    CREATE TABLE #MasterDate ([Date]...

  • RE: Can a JOIN be used here instead of a UNION?

    david.dartnell (9/3/2014)


    Hi Everyone,

    I am in the midst of writing a report which shows the 'Total Sales', 'Gross Profit', and 'Gross Profit %' by Sales Person. Traditionally I have used a...

  • RE: is there any downtime required for adding new column for a large table..and adding a newe table

    Hardy21 (9/2/2014)


    Adding new table doesn't require downtime at all.

    If your queries are not using SELECT * then you are ok to add new column (as it will not affect your...

  • RE: How to reduce the Clustered index seek cost

    Sure, but suggestions will depend upon the execution plan for the query exhibiting the problem. Can you post it please? - actual not estimated.

  • RE: Case Statement in Join condition

    Twin-devil: I think the OP wants to apply a row-level condition using values from table X, in which case dynamic sql won't work.

    The most common choice would be left...

  • RE: Case Statement in Join condition

    Indu-649576 (9/2/2014)


    IS there any way I can use the below

    Select X.* From TABLE X

    INNER JOIN

    (case when (condition) then TABLE A else TABLE B end) AS Y

    ON X.Col1 =...

  • RE: TEMP TABLE

    michael.petrone (9/1/2014)


    Here is the Question:

    I'm fine with declaring the table in the beginning.

    I want to check the temp table while selecting - first time through temp table will be empty.

    So...

  • RE: TEMP TABLE

    michael.petrone (9/1/2014)


    DML

    OUTPUT from Stored Procedure

    FOUND a copy of the stored procedure I'm working with----- see below----

    DECLARE @ItemClient TABLE

    (

    ClientSSN Varchar (11),

    LastName...

Viewing 15 posts - 2,956 through 2,970 (of 10,144 total)