Forum Replies Created

Viewing 11 posts - 406 through 416 (of 416 total)

  • RE: Show missing date

    imfairozkhan (10/29/2014)


    using calendar table is the only way???

    Here's a quick and dirty calendar generator using a tally table (you can find plenty of example here of how to build one)....

  • RE: Subquery returned more than 1 value Error

    amar_kaur16 (10/28/2014)


    The query works fine when the emplid does not exist in Table2, so it inserts the new record.

    Since I want to keep all the historic record in table2 and...

  • RE: Need Create View Script for all tables

    In case anyone thinks this example is a good idea I just want to add my vote to what Sean already suggested, namely: Never, never use SELECT * FROM a...

  • RE: round to two digit after decimel

    select left(cast(sum(saletotal) as money) / NumberofDays, CHARINDEX('.', cast(cast(sum(saletotal) as money) / NumberofDays as varchar(max)), 1) + 2)

  • RE: Using IN operator to find id exist or not

    selpoivre (10/26/2014)


    I want such query in which i put specific IDs in IN operator and give me result which are present in table and which are not.

    Will you run this...

  • RE: Remove non alpha chars from a column

    All right then, how about replacing the explicit string concatenation with "for xml path"?

    declare @originalText varchar(7500), @includeCharacters varchar(20), @cleanText varchar(7500)

    select @originalText = 'RBAR is pronounced "ree-bar" and is a "Modenism"...

  • RE: Remove non alpha chars from a column

    Maybe I'm missing something here, but this is simple and fast:

    declare @t varchar(5000) = 'RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row." This-divided-by,that|&/multiplied\by(100)give*you,%;<percent>.'

    declare @s-2...

  • RE: ISNULL

    Yikes. Methinks we've wrung a thunderstorm from a washcloth.

    The point of the question was to illustrate that ISNULL (or COALESCE) do not prevent nulls when used in...

  • RE: display values upto 1 decimal without function.

    Assuming that there are ALWAYS digits to the right of the decimal, then:

    select val, left(val, charindex('.', val) + 1)

    from (values

    ('99.87'), ('99.96'), ('8.67')) sampleData(val)

    If there are no digits...

  • RE: How to replace character from middle of words ??

    Forgive my impudence, but these solutions seem rather "clever." Given the problem domain, isn't this simpler?

    declare @mobile char(10), @maskChar char(1)

    select @mobile = '9334457582', @maskChar...

  • RE: Catch this!

    Sneaky!

Viewing 11 posts - 406 through 416 (of 416 total)