Forum Replies Created

Viewing 15 posts - 301 through 315 (of 1,082 total)

  • RE: Identical columns in clustered and non-clustered index

    and you sure that the non-clustered index doesn't have INCLUDE columns?

    If not then I would go with Lynn on this one, the index is not need, and may end up...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    I'm gonna try and teach you to work this one out, so you can understand how some of the SQL functions work.

    What you need to do is this. (use BOL...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    if it's always going top be 4 charaters then just use SUBSTRING with a lenght of 4.

    Look at BOL for how to use substring

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    try this one.

    SUBSTRING([YOURCOLUMN],PATINDEX('%MYNAME: %',[YOURCOLUMN])+8,DATALENGTH([YOURCOLUMN]))

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    ah you using a text field, that changes things

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    just replace my variable with your column name in your code and your done...

    for example:

    select

    incident.naam as Incident_Nr,

    incident.datumaangemeld as Datum_Aanmelden,

    incident.verzoek as Omschrijving,

    RIGHT(incident.verzoek,PATINDEX('% :EMANYM%',REVERSE(incident.verzoek))-1)

    from

    incident

    INNER JOIN classificatie ...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    not sure which is faster but here is another:

    SELECT RIGHT(@String,PATINDEX('% :EMANYM%',REVERSE(@string))-1)

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Remove characters from query result

    are always going to remove everything before and including "..MYNAME:" ?

    Is so then here is solution

    DECLARE @string VARCHAR(MAX)

    SET @string = '01-09-2008 09:07 MYNAME: This is the result text....'

    SELECT SUBSTRING(@string,PATINDEX('%MYNAME: %',@string)+8,LEN(@string))

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: SQL Query

    could you show us what you have so far?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: QOD logging me out of SSC

    Thanks Steve,

    sorry for the late reply.

    It's all working 100% now 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Multiple Values in Case statement

    try something like this.

    CREATE VIEW mynewview

    AS

    WITH MyCTE AS

    (SELECT a.col1,a.col2,b.col3,b.col4,b.col5,

    colMask = CASE

    WHEN ((b.col3 % 8) /4) >= 1 THEN 'Submit'

    WHEN ((b.col3 % 16) /8) >= 1 THEN 'Modify'

    ELSE 'None'

    END

    FROM mytable...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Multiple Values in Case statement

    try this:

    CREATE VIEW AS mynewview

    SELECT a.col1,a.col2,b.col3,b.col4,b.col5,

    colMask =

    CASE

    WHEN ((b.col3 % 8) /4) >= 1 --'Submit'

    THEN CASE

    WHEN ((b.col3 % 16) /8) >= 1 --'Modify'

    THEN 'Submit,Modify'

    ELSE 'Submit'

    END

    WHEN ((b.col3...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Slow performing select statement on large table

    The plan is to be expected to be honest, I'm just trying to work out how to get rid of the Key Look-up as this is where the big cost...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Slow performing select statement on large table

    along with what has already been mentioned above , have you updated the statistics?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Two column interdependency query

    Have you tried looking up in BOL for Recursive CTE's?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 301 through 315 (of 1,082 total)