Forum Replies Created

Viewing 15 posts - 376 through 390 (of 1,082 total)

  • RE: query not filtering

    Here is some code that does delimiting:

    DECLARE @String VARCHAR(100)

    DECLARE @Delimiter VARCHAR(2)

    SELECT

    @String = 'NE, SE, NW, SW, MA',

    @Delimiter = ', '

    SELECT SUBSTRING(@String+@Delimiter, n,

    CHARINDEX(@Delimiter, @String+@Delimiter, n) - n)

    FROM tally

    WHERE n...

    ----------------------------------------------
    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: sort rows in table from left to right (not top to bottom)

    Wow I didn't realise some folks where looking for a good pivot example 🙂

    ----------------------------------------------
    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: sort rows in table from left to right (not top to bottom)

    if it's an SSIS I would check to see that perhaps the data doesn't start unpivoted and then is actually pivot for the results.

    If this is the case then you...

    ----------------------------------------------
    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: Performance issue in an update statement

    indeed if your index clustered then it's prob not a good idea I agree...

    To be honest I'm not 100% where I learn't this but I could point to Gail's blog.

    She...

    ----------------------------------------------
    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: sort rows in table from left to right (not top to bottom)

    glad I could help 🙂

    ----------------------------------------------
    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: sort rows in table from left to right (not top to bottom)

    ok thing I found a solution. not sure how fast it will be but give it a go.

    DECLARE @tbl TABLE

    (ID INT IDENTITY(1,1),

    VAL1 INT,VAL2 INT,VAL3 INT,VAL4 INT,VAL5 INT)

    INSERT INTO @tbl

    SELECT 21,7,16,44,9...

    ----------------------------------------------
    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: Performance issue in an update statement

    thats understandable.

    Ok firstly why would you avoid composite indexes?

    It's one of the great tools available for performance on tables with regards to creating useful indexes for the optimizer to create...

    ----------------------------------------------
    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: sort rows in table from left to right (not top to bottom)

    could you show us the output for that example table please

    ----------------------------------------------
    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: Performance issue in an update statement

    I think Jack is talking about creating two composite indexes, each containing two columns.

    Looks like his suggestion would help you JOIN critea!

    Please could you attach the query plain as a...

    ----------------------------------------------
    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: Convert Integer Date to DateTime

    check for thats that are leap years but in a year that is not a leap year

    ----------------------------------------------
    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: Count To Include Nulls

    Please ref to my example that I posted with the test data.

    Simply change the table names and the column names...

    ----------------------------------------------
    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: Count To Include Nulls

    DECLARE @tbl1 TABLe

    (Id INT,

    Name VARCHAR(100))

    INSERT INTO @tbl1

    SELECt 1,'soemthing here' UNION ALL

    SELECT 2,'antoher here' UNION ALL

    SELECT 3,'should have 0 count'

    DECLARE @tbl2 TABLE

    (id int,

    Col2 VARCHAR(10))

    INSERT INTO @tbl2

    SELECT 1,'a' UNION ALL

    SELECT 1,'a' UNION...

    ----------------------------------------------
    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: Count To Include Nulls

    First I'm not sure why you hae those joins if there are no conditions or fields being returned?

    But you gonna want a left join to start with then put the...

    ----------------------------------------------
    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: Query Causing Error 1222

    are there any triggers on those tables?

    ----------------------------------------------
    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: convert varchar to datetime

    More reason for us to understand what fixed this, for future users

    ----------------------------------------------
    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 - 376 through 390 (of 1,082 total)