Forum Replies Created

Viewing 15 posts - 8,866 through 8,880 (of 15,381 total)

  • RE: Split strings alternative to XML

    MackF (3/29/2013)


    I am now testing this one:

    CREATE FUNCTION fnSplitString(@str nvarchar(max),@sep nvarchar(max))

    RETURNS TABLE

    AS

    RETURN

    WITH a AS(

    SELECT CAST(0 AS BIGINT) as idx1,CHARINDEX(@sep,@str) idx2

    UNION ALL

    SELECT idx2+1,CHARINDEX(@sep,@str,idx2+1)

    FROM a

    WHERE idx2>0

    )

    SELECT SUBSTRING(@str,idx1,COALESCE(NULLIF(idx2,0),LEN(@str)+1)-idx1) as value

    FROM a

    Execution is more...

  • RE: Query join

    mrivero1961 (3/28/2013)


    Sean Lange (3/28/2013)


    This is MySql. If you want to join multiple queries together you probably need to use UNION.

    I really can't tell from what you have posted what the...

  • RE: Search table field with LIKE clause

    kk1173 (3/28/2013)


    Full Index search will need an index on the view.

    And Indexed view will not be a good idea here since the data in case1 table is frequently updated.

    Then you...

  • RE: Query join

    This is MySql. If you want to join multiple queries together you probably need to use UNION.

    I really can't tell from what you have posted what the actual issue is...

  • RE: Query join

    mrivero1961 (3/28/2013)


    Thank you for help.

    I've modified the query, but the output not change:

    SELECT

    DATE_START,

    COALESCE (idDGIG, 'Tot') AS sGIG,

    `NUMBER`

    FROM

    (

    SELECT

    CA.DATE_START AS DATE_START,

    LEFT (CA.idDGIG, 2) AS sGIG,

    COUNT(CA.idDGIG) + COUNT(A.EVENT) AS NUMBER

    FROM

    TABLE_LONG CA

    JOIN TABLE_SHORT...

  • RE: Search table field with LIKE clause

    kk1173 (3/28/2013)


    Then why is the performance fast if i go directly against the employer table instead of view.

    For e.g.

    select * from Myview where display like '%aarp%'

    returns 26706 rows in 51...

  • RE: Different nolock question

    texpic (3/28/2013)


    Well I think it is a different question because I haven't seen it asked.

    If I do not have a join, I can do a query like this:

    SELECT * FROM...

  • RE: Query join

    The queries you posted have some stuff missing.

    In all cases you don't need to get the left 2 characters and then use like '%%'. The left can't possibly return anymore...

  • RE: Search table field with LIKE clause

    kk1173 (3/28/2013)


    Wildcard search needs to be done. If I do a value% it will do BeginWith.

    Then performance is never going to be very good for this. This is looking through...

  • RE: Java dynamically builds SQL

    Actually I can read java without much effort.

    Honestly I don't think converting this to straight t-sql is feasible in an online forum.

    There are least a dozen methods that have not...

  • RE: How to store a SQL statement in a table?

    Code-1029433 (3/28/2013)


    I'm needing to store a SQL statement in a VARCHAR(MAX) column in a database table, however I'm having trouble getting statemen to insert. What is the best aproach to...

  • RE: Search table field with LIKE clause

    Brandie Tarvin (3/28/2013)


    Sean Lange (3/28/2013)


    kk1173 (3/28/2013)


    discharged_entered is a date field.

    Then forget all the convert nonsense. Just compare it to a datetime.

    c.discharge_entered_dt >= DATEADD(DAY, -14, getdate())

    Sean, This won't necessarily work for...

  • RE: Java dynamically builds SQL

    You can certainly come up with something that will not be so ugly. However it is not possible for anybody to offer much more than vague ideas at this point...

  • RE: Search table field with LIKE clause

    Brandie Tarvin (3/28/2013)


    Also, your WHERE clause is potentially processing that CONVERT on a row-by-row basis (ouch!) to compare it to the column.

    Actually this won't run it for every row. The...

Viewing 15 posts - 8,866 through 8,880 (of 15,381 total)