Forum Replies Created

Viewing 15 posts - 3,196 through 3,210 (of 8,731 total)

  • RE: Wildcard parameter for multiple searches

    For multiple selections, you could use the DelimitedSplit8K to split the items. You can find it in here, along with the explanation to use it: http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Here's an untested example on...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Is this possible

    Let's say you run this yesterday, which is Monday of week 12, which goes from March 13 to March 19.

    Should you compare it to week 12 of 2015? Or week...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: noob SSRS questions.

    snomadj (3/15/2016)


    Forgive me ... I know nothing about SSRS & would appreciate your time:

    Background:

    2008 R2.

    Reports I need will not be overly complex / resource intensive.

    I have 20 odd instances...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subtracting a case statement result from a Convert(char(8) result

    I'm using 2 variables, because I don't have sample data provided by you.

    I'm using @StartDT which for you is either QueueDate or StartDate if QueueDate is null.

    This is translated...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Split Multiple Times

    I would upload the file using bulk insert or something similar to avoid the pivot and the additional split. But I was waiting for a reply from the OP.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subtracting a case statement result from a Convert(char(8) result

    ZZartin (3/14/2016)


    That format is pretty straight forward if you have the diff in seconds.

    SELECT CAST( (DATEDIFF(second, '3/14/2016', getdate()) / 60) / 60 AS varchar) + ':' + CAST( (DATEDIFF(second,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subtracting a case statement result from a Convert(char(8) result

    jimtimber (3/14/2016)


    Hi Lowell, thanks for your help, this runs without error and returns the result in minutes. I modified it so it returns seconds for what I need. However, I...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: subtracting a case statement result from a Convert(char(8) result

    Why use a CASE statement?

    SELECT DATEDIFF(ss,ISNULL(QueueDate,StartDate),EndDate)

    For duration, here's a formula using date/time calculations.

    DECLARE @StartDT DATETIME2

    ,@EndDT DATETIME2

    ;

    SELECT @StartDT =...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to add servername into a query.

    Just add it to your query?

    SELECT @@SERVERNAME,

    p.name AS [loginname] ,

    p.type ,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: using converted var char date time field to return records in a date

    LinksUp (3/14/2016)


    I'm not sure why this has not been mentioned yet since it is a standard construct to get rows between dates.

    I would use something like this:

    declare @UserDate date...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: using converted var char date time field to return records in a date

    Jack Corbett (3/14/2016)


    Luis Cazares (3/14/2016)


    Jack Corbett (3/14/2016)


    macdca (3/14/2016)


    "or you need to convert the column to a date without time (no index seeks possible)." - how do...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: But we've always done it that way…

    Eric M Russell (3/14/2016)


    Jeff Moden (3/14/2016)


    andrew gothard (3/14/2016)


    Wayne West (8/3/2015)


    Fast/Cheap/Correct: choose two.

    Also, bear in mind, if you fail to choose Correct, you can forget about the other two...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: using converted var char date time field to return records in a date

    Jack Corbett (3/14/2016)


    macdca (3/14/2016)


    "or you need to convert the column to a date without time (no index seeks possible)." - how do I do that?

    CONVERT(DATE, ScheduledActivity.ScheduledDateTime)

    As the number...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: using converted var char date time field to return records in a date

    Set the parameter as a date type, then change the condition to this:

    WHERE ScheduledActivity.ScheduledStartTime >= @Date

    AND ScheduledActivity.ScheduledStartTime < DATEADD(DD,1,@Date)

    Don't use strings if they're not needed.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: using converted var char date time field to return records in a date

    Don't convert the column's data types, especially from date/time data types to strings.

    Convert the parameters to the column's data type.

    It should look like this:

    ScheduledActivity.ScheduledDateTime = CONVERT(datetime, '13/04/2016', 103)

    If you don't...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 3,196 through 3,210 (of 8,731 total)