Forum Replies Created

Viewing 15 posts - 241 through 255 (of 272 total)

  • RE: DBCC Timewarp

    Don't know if I can imbed, but if you follow this . . .

    http://www.youtube.com/watch?v=nyssf9k0qdM

    Converting oxygen into carbon dioxide, since 1955.
  • RE: DBCC Timewarp

    RBarryYoung (2/16/2010)


    Steve Cullen (2/16/2010)


    It's just a jump to the left. And then a step to the right. 😛

    Put your hands on your hips?

    ...and pull your knees in tight.

    Converting oxygen into carbon dioxide, since 1955.
  • RE: DBCC Timewarp

    It's just a jump to the left. And then a step to the right. 😛

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Use Variable as SQL column Name in query

    I'm not really sure what your requirement is. You will need to use some form of dynamic sql.

    declare @ColumnName varchar(50)

    declare @sql nvarchar(max)

    set @ColumnName = 'SalesData_' + convert(varchar(2),datepart(dd,getdate()))

    set @sql =...

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Query Help - difference between last and current year

    Give this a shot.

    ; with Year2010 AS (

    Select

    AREA,SRC

    ,case

    when DATE between '1/1/2010' AND getdate() THEN 'YTD 2010'

    when DATE between '1/1/2009' AND dateadd(yy,-1,getdate()) THEN 'YTD 2009'

    else 'Not...

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Data Comparison

    Golly!

    SELECT

    a.Sales[Y09Q4 Sales]

    , b.Sales[Y08Q4 Sales]

    , (a.Sales - b.Sales) AS [Difference]

    FROM sales a

    INNER JOIN sales b

    ON (b.Yr + 1) = a.Yr

    AND b.Qtr = a.Qtr

    WHERE a.Yr = 2009

    AND a.Qtr =...

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    That's pretty much it. You store and manipulate in datetime format and output/format to a string, usually.

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Data Comparison

    Something like :

    SELECT

    a.Yr, a.Qtr, a.Sales, (a.Sales - b.Sales) AS [Difference]

    FROM sales a

    INNER JOIN sales b

    ON (b.Yr + 1) = a.Yr

    AND b.Qtr = a.Qtr

    WHERE a.Yr = 2010

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    OK, it does work. Must test better 🙂

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    Well that won't work. In this case I would use two variables based off of the same value such as :

    DECLARE @mydate datetime, @mydatestring varchar(20)

    SELECT @mydate = getdate()

    SELECT @mydatestring...

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    You can convert it back to datetime if you need to :

    INSERT INTO tableA (columnA)

    SELECT CONVERT(datetime,@mydate)

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    Hmmmm. Must type faster.:-)

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Set Variable based on a SELECT

    DECLARE @mydate varchar(20)

    SELECT @myDate = CONVERT(CHAR(9),GETDATE(),1) + SUBSTRING(CONVERT(CHAR(5),GETDATE(),14),1,5) + ' '

    print @mydate

    Converting oxygen into carbon dioxide, since 1955.
  • RE: Time intervals

    We find it handy to keep a static calendar table around with dates and attributes such as IsHolliday and DayOfWeek, Month, Quarter, FiscalYear etc.

    Ours starts at 1/1/1900 and goes to...

    Converting oxygen into carbon dioxide, since 1955.
  • RE: need querry to omit the tables under the system tables in the msdb.

    Are you trying to distinguish between system tables and tables added by someone else?

    Unless you or someone else creates a table in msdb, they are all system tables. Unless...

    Converting oxygen into carbon dioxide, since 1955.

Viewing 15 posts - 241 through 255 (of 272 total)