Forum Replies Created

Viewing 15 posts - 91 through 105 (of 2,894 total)

  • RE: display values upto 1 decimal without function.

    abhas (9/11/2014)


    Hi all,

    in addition above.

    Hi,

    put varchar datatype, why because actual data is like: Sorry for not mentioning earlier.

    99.87%, 99.96%, 8.67%

    and out put want as

    99.8%

    99.9%

    8.6%

    Thanks,

    Abhas.

    Even worst that I thought!

    Why...

  • RE: display values upto 1 decimal without function.

    abhas (9/11/2014)


    Hi All,

    Thanks for reply.

    But is it possible search "." and select only one character after ".". because dataype is varchar here.

    kindly help.

    Thanks,

    Abhas.

    It is possible by plain stupid... Why...

  • RE: display values upto 1 decimal without function.

    jacksonandrew321 (9/11/2014)


    Hi u can use as

    SELECT CAST(AVG(values) AS DECIMAL(10,1))

    FROM tablename;

    Thanks

    Yep, or he could use:

    SELECT CASE WHEN SUM(values * 1.234) + MAX(values)/64 > 1 THEN 'Good' ELSE...

  • RE: display values upto 1 decimal without function.

    Shadab Shah (9/11/2014)


    I guess this might help

    SELECT cast (round(11.63,1) as numeric(12,1))

    /*Replace your column name instead 11.63*/

    Have you tested it with just one value?

    Try:

    SELECT cast (round(11.67,1) as numeric(12,1))...

  • RE: display values upto 1 decimal without function.

    If you output to client, do it there.

    If you need this values for futher use in SQL, you have multiple options.

    Some here:

    SELECT ROUND(val,1,1)

    ...

  • RE: Check the Variable is Empty or Null

    Eirikur Eiriksson (9/9/2014)


    Alan.B (9/9/2014)


    IF @user > '' --This checks for not null and not empty

    Cool. I never knew you could do that, very interesting :laugh:

    Edit: sql code tag messed up...

  • RE: Check the Variable is Empty or Null

    Alan.B (9/9/2014)


    IF @user > '' --This checks for not null and not empty

    Cool. I never knew you could do that, very interesting :laugh:

    Edit: sql code tag messed up my "greater...

  • RE: Factor/Rate rounding Issue

    This is called "allocation issue".

    You need to correct/adjust your calculated ratio so it will sum up to 100%

    The simplest way is to chose which single item ratio you would want...

  • RE: Replace a Cursor

    Yes, you could write the code so that it creates a single dynamic sql based code set that would import the data from the tables all at once...

    Yep, building @sql...

  • RE: Counting Decimal Places in a float field

    hughesj23 (7/3/2014)


    Thank you Sean! I like that one the best. I could wrap my mind around that one a little easier and it works great. I appreciate...

  • RE: Counting Decimal Places in a float field

    Pulivarthi Sasidhar (7/3/2014)


    Use RIGHT and CharIndex and LEN function by converting/casting those fields as varchar and apply your logic....

    Try converting FLOAT to VARCHAR and you will find that it is...

  • RE: If not exists returning false when should be true

    Not sure about the exists, but it doesn't look like a loop is needed at all...

    As well as there is no need in transaction control over single insert statement...

    Something tells...

  • RE: If not exists returning false when should be true

    The exact code you have posted is absolutely correct.

    It might be something else in your real code which makes it fail.

    Also, I would recommed to write such inserts with...

  • RE: Select query error

    try to add

    PRINT @dbuser_sql

    Before executing it.

    I guess you may need to change:

    "LEFT OUTER JOIN ?." to "LEFT OUTER JOIN [?]."

  • RE: Return Count

    Check this setup:

    CREATE PROC usp_Test

    AS

    DECLARE @t TABLE (v int)

    SELECT 1 [Val]

    GO

    Now lets test:

    EXEC usp_Test

    SELECT @@ROWCOUNT

    Stored proc retunrs resultset with one...

Viewing 15 posts - 91 through 105 (of 2,894 total)