Forum Replies Created

Viewing 15 posts - 2,446 through 2,460 (of 5,841 total)

  • RE: Format varchar to currency.

    DECLARE @var varchar(10), @money money

    SET @var = ($111.11)

    SET @money = -1* CAST(CASE WHEN LEFT(@var,1) <> '(' THEN @var

    ...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: does it make difference nvarchar(50) or nvarchar(500)

    It can ABSOLUTELY make a difference, depending on the ANSI_PADDING setting for the columns when you created the table. If it is ON and you insert data that has...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Need help with my tsql code

    Please provide table create script(s) (with indexes if any), sample data to put in said table(s), and expected output from your code.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Issues with partitioning...

    T.Ashish (8/18/2013)


    Hi All,

    I was trying to use partitioned index for a slow query but I was stopped with following response...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Get Totals from a Query

    OP is a new user. I already PM'd them back about that. Hopefully they will post up on this thread.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Get Totals from a Query

    Please provide table create scripts with sample data and expected output and we can write a query to assist. Enable us to help you...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Help on query

    jethrow (8/17/2013)


    Another option:

    SELECTname, CASE

    WHEN Mark1>Mark2 AND Mark1>Mark3 THEN 'Mark1'

    WHEN Mark2>Mark3 THEN 'Mark2'

    ELSE 'Mark3' END

    FROMSample;

    CASE: My favorite 4-letter TSQL word!! 😎

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Extracting a Date from a string

    What you seek to do is literally impossible without some identification of the type of date format provided. The reason is that you can have a at least 2...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Query COUNT incorrect

    I would imagine that your query references VIEWS given the naming scheme, meaning we have no idea what is going on in your code. To have much hope of...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Performace issue Physical vs Virtual

    Glad we found some improvements. There are still quite a few things to check, but I think though that anything more will be beyond the capabilities of a forum...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Need help with query

    Something like this, although again you have provided very limited data.

    ;WITH a AS (

    SELECT agentid, 'Open' AS ExceptCodeDetailName, Detail_Start_Time,

    Detail_End_Time, ROW_NUMBER() OVER (order by AgentID, Detail_End_Time, Detail_Start_Time) AS rownum

    FROM @testing)

    SELECT a1.agentid,...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Need help with query

    Given that you are on SQL 2012, here is one solution that uses the new Windowing Functions:

    ;WITH a AS (

    SELECT agentid, 'Open' AS ExceptCodeDetailName,

    Detail_End_Time AS Detail_Start_Time,

    LEAD(Detail_Start_Time,1,NULL) OVER (order by...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Alternate of materialized view to avoid excessive table reads where Min/Max is required

    We need the actual table definition too, with indexes. Also, is that a character field stored to look like a date or an actual date data type?

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • RE: Performace issue Physical vs Virtual

    fraze2001 (8/12/2013)


    OK, so I've tested on an instance on another physical machine that is exactly the same hardware spec as the other physical and the physical running the VM. In...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

Viewing 15 posts - 2,446 through 2,460 (of 5,841 total)