Forum Replies Created

Viewing 15 posts - 136 through 150 (of 162 total)

  • RE: Help with DatePart or Dataadd view script?

    i suppose you could add this to the where clause

    AND PIT != CONVERT(CHAR(10),GETDATE(),121) + '16:00:00'

    This will check the PIT column and exclude the current day at 16:00. Remember though...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: DELETE Statements when using a JOIN - Best Practice

    personall i prefer a join - like so:

    DELETE a

    FROMtablea a

    INNER JOINtableb b

    ONa.column = b.column

    WHEREcondition

    As far as standards go - i'm not too sure,...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Consolidate SQL server jobs

    This may be a bit ott, but check this out:

    http://sqlcms.codeplex.com/

    This is the sql server central management system.

    You can use policies (using the policy management framework) to check the...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    so you have another column called PIT which holds datetime values?

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    david.ostrander (1/31/2012)


    You have helped me out so much Thank you... I can see how it all works now.

    Thats what the community is for right ? 🙂

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    It certainly is possible 🙂

    WHERE[DateTime_Column] >= CONVERT(CHAR(10),DATEADD(DD,-7,GETDATE()),121)

    AND[DateTime_Column] < CONVERT(CHAR(10),DATEADD(DD,91,GETDATE()),121)

    the dateadd function is very flexible. You can + or - days, months, years, minutes, hours etc. play around with...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    I don't quite understand, 1 week back would be 24th jan 🙂

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    for a view instead of declaring variables change the where clause to the following;

    WHERE[DateTime_Column] >= CONVERT(CHAR(10),GETDATE(),121)

    AND[DateTime_Column] < CONVERT(CHAR(10),DATEADD(DD,91,GETDATE()),121)

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    what version of sql server are you using? The way i've declared the variables are specific to sql 2008 +

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help with DatePart or Dataadd view script?

    a select statement could look like the following:

    DECLARE @DateStart DATETIME = CONVERT(CHAR(10),GETDATE(),121);

    DECLARE @DateEnd DATETIME = DATEADD(DD, 91, @DATESTART);

    SELECT*

    FROM

    WHERE[DateTime_Column] >= @DateStart

    AND[DateTime_Column] < @DateEnd

    Hope that helps

    //Edit made the dateadd add 91 days...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Books for Newbies?

    GilaMonster (1/27/2012)


    Excellent as that book it, it assumes some knowledge.

    For basic T-SQL, try Itzik Ben-Gan's T-SQL Fundamentals. Not sure about a beginner's guide to SQL Server though

    I've attended one of...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: sp_executesql vs exec

    exec or execute

    http://msdn.microsoft.com/en-us/library/ms188332.aspx

    sp_executesql

    http://msdn.microsoft.com/en-us/library/ms188001.aspx

    simples.

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help me

    SQL Kiwi (1/31/2012)


    Loundy (1/31/2012)


    I've seen a few examples on the forums where some people have used a CTE with the row_number() function and others have used cross apply - I...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Merge Columns of different tables

    I believe something like this will do the trick.

    CREATE TABLE #table1 (ID INT,SIN_ID INT,AgentCode_ID VARCHAR(30), Amount DECIMAL(5,2))

    CREATE TABLE #table2 (ID INT,SIN_ID INT,AgentCode_ID VARCHAR(30), Amount DECIMAL(5,2))

    CREATE TABLE #table3 (ID INT,SIN_ID INT,AgentCode_ID...

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • RE: Help me

    Paul,

    I've seen a few examples on the forums where some people have used a CTE with the row_number() function and others have used cross apply - I understand both...

    [font="Times New Roman"]There's no kill switch on awesome![/font]

Viewing 15 posts - 136 through 150 (of 162 total)