Forum Replies Created

Viewing 15 posts - 91 through 105 (of 246 total)

  • RE: Columns to Rows - Pretty please can someone help?

    select

    title,

    sum(convert(int,flag))

    from (

    select * from @ZL_Calculation1

    )p

    unpivot

    (

    Flag for Title IN (a_flag,b_flag,c_flag,d_flag,e_flag)

    ) unpvt

    group by Title

  • RE: Tabs or Spaces

    i prefer tabs to spaces.

    main reason is probably because i can highlight multiple rows and tab them across where as if i did that with the spacebar it would delete...

  • RE: Incrementing a table name

    i haven't had time to test it but it sounds right. as you say, it rounds it to the nearest minute. the data we hold doesn't usually come in with...

  • RE: SQL and binary numbers

    doesn't just converting it to an int work?

    select * from tableName where (convert(int,colname) & 32 = 32)

  • RE: SQL and binary numbers

    select * from tableName where (colname & 32 = 32)

  • RE: Incrementing a table name

    well i couldn't work out why i couldn't insert using the Partitioned View.

    so i took the code from the CheckConstraint, and ran a straight forward SELECT statement

    SELECT * FROM Table2008...

  • RE: Multiple count() in a single SQL

    select

    sum(1) as Total,

    sum(case igroup when 1 then 1 end) as Group1,

    sum(case igroup when 2 then 1 end) as Group2,

    sum(case igroup when 3 then 1 end) as Group3,

    sum(case igroup when 4...

  • RE: Incrementing a table name

    resolved the problem. for some reason, when i had:

    ([ConfirmDate]>='2008-01-01 00:00:00' AND [ConfirmDate]<='2008-12-31 23:59:59')

    it was allowing all dates through, including from the year 2009.

    if i changed it to

    ([ConfirmDate]>='2008-01-01 00:00:00' AND [ConfirmDate]<='2008-12-31...

  • RE: Incrementing a table name

    [UPDATED: New CREATE TABLE code]

    i've been playing around abit more with Partitioned Views but have come across a problem.

    here are the 3 tables that i have created as a test:

    CREATE...

  • RE: Incrementing a table name

    Jeff Moden (2/28/2012)


    davidandrews13 (2/28/2012)


    The 7th table contains data from the year 2011 onwards, so currently i dont want to put a constraint on it.

    You must include the constraint on the...

  • RE: Incrementing a table name

    thanks Jeff.

    i've used this link as my reference:

    http://msdn.microsoft.com/en-us/library/aa933141(v=sql.80).aspx

    so i've set a CheckConstraint on 6 of the 7 tables that are mentioned in my View:

    table2005

    table2006

    table2007

    table2008

    table2009

    table2010

    ([ChangedDate]>='2008-01-01 00:00:00' AND [ChangedDate]<='2008-12-31 23:59:59')

    obviously, the year...

  • RE: Incrementing a table name

    Jeff Moden (2/25/2012)


    gary.morey (2/24/2012)


    I have a sql server table named raw17. Is there a way to create a new table that increments the number in the table name by...

  • RE: Insert without using a cursor

    something like this?

    here's an article on the tally table

    http://www.sqlservercentral.com/articles/Tally+Table/70735/

    declare @testitem TABLE (

    itm_item varchar(43) NOT NULL,

    itm_desc varchar(100) NOT NULL,

    wsd_quantity int NOT NULL)

    INSERT INTO @testitem

    SELECT 'CHCWPSU10DMX','Chroma-Q Color Web Power Supply Unit For...

  • RE: Old Dog, New Tricks

    Steve Jones - SSC Editor (2/2/2012)


    davidandrews13 (2/2/2012)


    isn't that just down to formatting though? the fact that the article has coloured the ColumnNames in green, which wouldn't be the case normally,...

  • RE: Old Dog, New Tricks

    Gary Varga (2/2/2012)


    It was when I looked at the side-by-side stored procedures example that it became clear. Literally!!!

    ?

    isn't that just down to formatting though? the fact that the article has...

Viewing 15 posts - 91 through 105 (of 246 total)