Forum Replies Created

Viewing 15 posts - 4,516 through 4,530 (of 7,614 total)

  • RE: Getdate() error

    If you mean all times for today's date, and not all times for the immediately preceding 24 hours, then you should do this:

    WHERE (a.DateAppReceived >= DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0)...

  • RE: Need help constructing this SQL Statement, against one table only (table with three columns)

    You need a WHERE condition on the SELECT from the CTE:

    ...

    SELECT log1.ID,

    log1.STime StartTime,

    log2.STime EndTime,

    DATEDIFF(second, log1.STime,...

  • RE: Need to negate a where clause

    For performance reasons, you should never use ISNULL in a WHERE (or JOIN) clause, because you'll prevent possible index seeks on the underlying column. While the code below is...

  • RE: Number VS Letter

    I'd at least compare the performance of the straightforward brute-force method:

    SELECT

    word AS original_string,

    CASE WHEN SUBSTRING(word, 01, 1) LIKE '[0-9]' THEN SUBSTRING(word, 01,...

  • RE: Need help constructing this SQL Statement, against one table only (table with three columns)

    Something like this might (or might not) perform better, if you need to calc time diff for just those two steps:

    SELECT lst.SNum, lst.SOpDesc, lst.STime,

    CASE WHEN...

  • RE: How to reduce Huge Log File size

    Jeff Moden (12/25/2015)


    ScottPletcher (12/25/2015)


    Jeff Moden (12/24/2015)


    You've confused me a bit, Scott. First you say that 16 VLFs for a 1GB logfile is too low and then you explain using...

  • RE: Cursor or special select statement?

    SELECT c.Cust#, c.Name, c.Address, --c....

    STUFF(

    CASE WHEN cd.Monday = 1 THEN ',Mo' ELSE '' END +

    CASE WHEN cd.Tuesday =...

  • RE: create stored procedure with if condition

    baiju krishnan (12/25/2015)


    when i tried to execute your code following error shown

    Msg 8117, Level 16, State 1, Procedure Sp_Login, Line 19

    Operand data type bit is invalid for max operator.

    Then we'll...

  • RE: How to reduce Huge Log File size

    Jeff Moden (12/24/2015)


    You've confused me a bit, Scott. First you say that 16 VLFs for a 1GB logfile is too low and then you explain using even fewer VLFs...

  • RE: How to use 'like' in a query

    Since Transaction_Date contains the time, a query coded like this:

    Activity.Transaction_Date BETWEEN '20151130' and '20151201'

    Would return rows from 12/01/2015 at exactly midnight (if there were any). But that wouldn't really...

  • RE: How to use 'like' in a query

    select Name.ID, Name.FULL_NAME, Name.FULL_ADDRESS, Name.EMAIL, Activity.ID, Activity.ACTIVITY_TYPE, activity.SOURCE_CODE, activity.TRANSACTION_DATE, Activity.DESCRIPTION

    from Name

    INNER JOIN Activity

    ON Name.ID=Activity.ID

    where Activity.Activity_Type = 'CALL' and SOURCE_CODE = 'BWILSON' and

    Activity.Transaction_Date >= '20151130' and

    Activity.Transaction_Date < '20151201'

    order by Name.ID,...

  • RE: How to use 'like' in a query

    WHERE Transaction_Date >= '20150101' AND Transaction_Date < '20160101'

  • RE: create stored procedure with if condition

    Your code doesn't match your description. Here's code that matches your description.

    For efficiency, I've limited it to a single SELECT from the login table.

    CREATE PROCEDURE [dbo].[Sp_Login]

    @uname nvarchar(20),

    ...

  • RE: How to reduce Huge Log File size

    Jeff Moden (12/23/2015)


    ScottPletcher (12/23/2015)


    Jeff Moden (12/22/2015)


    WhiteLotus (12/21/2015)


    Sounds good ..I also notice that all databases autogrowth option are 10% . Should I change all of them ?

    If the initial size was...

  • RE: Converting and Assigning a Date Variable

    The internal format of date (or datetime or other temporal data type) is not the same as the character format we humans use. In fact, it's just an integer....

Viewing 15 posts - 4,516 through 4,530 (of 7,614 total)