Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 1,469 total)

  • RE: How to create duplicate columns in sql server 2008

    ChrisM@Work - Friday, January 13, 2017 2:08 AM

    poornima.s_pdi - Friday, January 13, 2017 2:02 AM

    Hi,
    I need...

  • RE: Need to create index for the resultened query and retrieve the data from the second column

    You can try this

    select TOP 1 count(*) as [number of occurences]
    from (
    select case
      when answer_count between 0 and 5 then '...

  • RE: SSC Forum Updates

    Formatted SQL code that is wider than the display box does not wrap.  There are scroll bars, but they only seem to work if you highlight text and keep going....

  • RE: SSC Forum Updates

    I am really not liking the new interface.
    There is waaaay too much white space.  Makes everything look clunky.

  • RE: Return some rows in columns

    WITH cteSports AS (

    SELECT * ,sn = ROW_NUMBER() OVER (PARTITION BY name ORDER BY sport)

    FROM #example

    )

    SELECT

    cte.name

    , cte.city

    , cte.entryDate

    , sport1 = MAX(CASE WHEN cte.sn =...

  • RE: Gracefully Handling CLR Function Problems

    When SQL processes a batch of records, it's an all or nothing process. If one of them has an error, all are aborted.

    The only way to do skip a...

  • RE: t-sql 2012 pick most current record

    Here are 3 different approaches that will acheive the same results

    -- Using cte with ROW_NUMBER

    WITH cte AS (

    SELECT CustID, PrintedDate, rn = ROW_NUMBER() OVER (PARTITION BY CustID ORDER...

  • RE: Header to Many rows

    Since your query does not have an ORDER BY clause, you are not guaranteed of any specific order.

    Perhaps adding the following to the end of your query will help

    ORDER BY...

  • RE: How to update column value

    spectra (1/5/2017)


    DesNorton (1/5/2017)


    INSERT INTO PRIOR_DIST (_ID, COSTS_DST, IS_ACTIVE)

    SELECT

    @_id,

    ROUND(CASE WHEN ta.const1 IS NULL OR ta.const1 != 0 THEN pd.COSTS_DST * ta.const1 / @const2

    ...

  • RE: How to update column value

    INSERT INTO PRIOR_DIST (_ID, COSTS_DST, IS_ACTIVE)

    SELECT

    @_id,

    ROUND(CASE WHEN ta.const1 IS NULL OR ta.const1 != 0 THEN pd.COSTS_DST * ta.const1 / @const2

    ...

  • RE: How to update column value

    spectra (1/5/2017)


    thats an impressive code !

    You are the SQL God.

    Thanks for the quick post.

    I am a relative noob, with sooo much to learn.

    Just glad I could be of help.

  • RE: How to update column value

    spectra (1/5/2017)


    Thank you.

    I wish to add one condition in my code i.e a zero value checking .

    like this ...

    if(@const1!=0)

    INSERT INTO PRIOR_DIST (_ID, COSTS_DST, IS_ACTIVE)

    SELECT

    @_id,

    COSTS_DST*@const1/@const2,

    'Y'

    FROM PRIOR_DIST

    WHERE _ID = @id_prev;

    else

    INSERT INTO...

  • RE: Trying to run TSQL queries with regular query in same SQMS querywindow

    You could also use a virtual tally table

    declare @startdate DATE = '2016-04-01'

    , @enddate DATE = '2016-04-30'

    ...

  • RE: How to update column value

    spectra (1/5/2017)


    DesNorton (1/5/2017)


    Is it possible to round the result up to 10 decimal place for the insert. Is there any way ?

    What is the datatype of COSTS_DST?

    If it is...

  • RE: How to update column value

    INSERT INTO PRIOR_DIST (_ID, COSTS_DST, IS_ACTIVE)

    SELECT

    @_id,

    COSTS_DST*@const1/@const2,

    'Y'

    FROM PRIOR_DIST

    WHERE _ID = @id_prev;

Viewing 15 posts - 1,291 through 1,305 (of 1,469 total)