Forum Replies Created

Viewing 15 posts - 5,851 through 5,865 (of 8,731 total)

  • RE: Can't log out.

    HanShi (9/9/2014)


    DBA_123 (9/9/2014)


    Hi,

    Can you not go to task manager and kill MMC.exe?

    And in the worst case scenario you could just turn off and restart the computer (hold the powerbutton for...

    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: Cursor - Declare variable error

    I agree with Sean, but I feel that that's not everything that you do on your cursor.

    To prevent problems if someone messed up with the data on your table, 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: How to Round a date to the nearest second

    And I forgot to post the easy way to do it. :w00t:

    SELECT CAST(GETDATE() AS datetime2(0));

    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 Round a date to the nearest second

    This might work for you.

    DECLARE @Today datetime = DATEADD( dd, DATEDIFF( dd, 0, GETDATE()), 0)

    SELECT GETDATE(),

    DATEADD( ms,

    ...

    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: Not Cast?

    The operation varies depending on the data type you expect.

    DECLARE @String varchar(4) = '20',

    @String2 char(50) = '20',

    @int int = 20;

    SELECT RIGHT( '0000'...

    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: Select past 3 dates and determine if the 1st and 3rd are within a timeframe

    I don't. I just validate that there are at least 3 dates within the range. This works if the dates aren't important and you just want to know the companies.

    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: Select past 3 dates and determine if the 1st and 3rd are within a timeframe

    Here's a different approach.

    WITH MinDates AS(

    SELECT CompanyId,

    DATEADD( dd, -15, MAX(ActivityDate)) MinDate

    FROM ActivityTable

    ...

    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: Are the posted questions getting worse?

    Eirikur Eiriksson (9/7/2014)


    Just a thought, what about the ability to rate questions? Could be something like "splendid question" all the way down to "interesting" or "PICNIC".

    😎

    Isn't that what this...

    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: Are the posted questions getting worse?

    This is like torture. I'm at the office, unable to watch the first games of the NFL season and can only see all the spam promoting supposed pages to watch...

    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: Select second row of a table

    baijuep (9/7/2014)


    Sir, i tried the second query and it gives following error

    Msg 8120, Level 16, State 1, Line 1

    Column 'Trade.Trade' is invalid in the select list because it is not...

    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: Unable to insert values into a column- insert fails with error message

    The problem is that when you insert the value into NEWCOLUMN, you're inserting NULLS and default values in the other columns to complete the row.

    If you have a PK...

    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: Select second row of a table

    I don't understand your problem. What's PL, KM, KT? How do you define the first and the second row? There's no default order on SQL.

    Your query seems inefficient. You could...

    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: Are the posted questions getting worse?

    Eirikur Eiriksson (9/4/2014)


    Luis Cazares (9/4/2014)


    batgirl (9/4/2014)


    Lynn Pettis (9/4/2014)


    Yes, I actually threw one of Mr. Celko's own arguments back at him in a post talking about dates.

    I liked the COBOL reference...

    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: help parsing a text field

    This solution is an alternative which might be better or might be worse. It can be complicated because each column requires 7 functions and it won't work with 5 columns....

    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: pivot 3 columns

    You could do it in the same EXEC() statement. The problem is that you need to be sure that you're generating the same columns or you'll get an error.

    Here's an...

    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 - 5,851 through 5,865 (of 8,731 total)