Forum Replies Created

Viewing 15 posts - 16 through 30 (of 1,311 total)

  • Reply To: Datatype conversion error_ replace with NULL

    You can use TRY_CAST or TRY_CONVERT

    UPDATE #Data
    SET Number = TRY_CAST(Number AS float);
  • Reply To: How do you change the whole theme of SQL Server 2014 Management Studio to black?

    Locate the ssms.pkgundef file and edit it as follows

    Comment out the following line at the end of the file, and save the file.

    • [$RootKey$\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}]

    Then restart SSMS, and select the theme

      ...
  • Reply To: can not get cursor to work for me

    CursorID is an integer, not a collection.

    You need to declare a variable for each field that the cursor returns

     

  • Reply To: Simple sort makes query hang

    SQL does not necessarily evaluate a CTE or sub-query when you think it does.  It will un-nest them if it believes that it is more efficient to do so.

    Watch the...

  • Reply To: Simple sort makes query hang

    pdanes wrote:

    ...

    5. 6070. As I wrote in the initial post, I would expect the inner query to return these rows, a fairly small number, then give me the top one...

  • Reply To: startdate -1

    The following code satisfies your requirement

    SELECT  t.Testid
    , t.Status
    , t.Startdate
    ...
  • Reply To: startdate -1

    So, taking a guess at what you are looking for ....

    WITH cteData AS (
    SELECT t.Testid
    , t.Status
    ...
  • Reply To: startdate -1

    Shree23 wrote:

    I have repeated and loaded  the insert statement

    insert into table3 values ('1','Progress', '20210203'), ('1', 'Closed', '20220403'), ('2', 'Closed', '20220703'), ('2', 'Progress', '20220503')

    it is showing wrong output

    Screenshot 2022-03-15...</p><div class=


    How to post data/code on a forum to get the best help.

  • Reply To: startdate -1

    You are on the right track.

    SELECT t.Testid
    , t.Status
    , t.Startdate
    , EndDate = DATEADD(dd,...
  • Reply To: startdate -1

    Your expected output is inconsistent.

    That said, I believe that you need to look at the LAG function.

  • Viewing 15 posts - 16 through 30 (of 1,311 total)