Forum Replies Created

Viewing 15 posts - 586 through 600 (of 2,894 total)

  • RE: Complex SQL QUERY with DateDIFF

    Mark-101232 (3/14/2013)


    Eugene Elutin (3/14/2013)


    "Looks like" - it just really "Looks like" nothing more. That is whole problem for recursive CTE's - they are fine for limited number of recursions, they...

  • RE: Complex SQL QUERY with DateDIFF

    "Looks like" - it just really "Looks like" nothing more. That is whole problem for recursive CTE's - they are fine for limited number of recursions, they not very well...

  • RE: Split A String into 4 parts

    Alan.B (3/13/2013)


    Eugene Elutin (3/13/2013)


    declare @filename varchar(100)

    set @filename = 'Notes_20130204_003015.txt';

    select PARSENAME(replace(@filename,'_','.'),4)

    select PARSENAME(replace(@filename,'_','.'),3)

    select PARSENAME(replace(@filename,'_','.'),2)

    select PARSENAME(replace(@filename,'_','.'),1)

    Fantastic use of PARSENAME! Wow!

    Not really. Quite slow one, actually. But will suite to the purpose...

  • RE: Convert String to Time Format

    or you can use something like this:

    DECLARE @time TABLE (StringTime VARCHAR(6))

    INSERT @time

    SELECT '112345'

    UNION SELECT '12345'

    UNION...

  • RE: Complex SQL QUERY with DateDIFF

    Those logtimes look sequential to me - are you sure?

    What do you mean by "sequential"? These LogTimes are for the same UserId, they are unique and they grow in its...

  • RE: Complex SQL QUERY with DateDIFF

    Cause some log data can be a bit different.

    Try this one:

    SET DATEFORMAT dmy;

    CREATE TABLE #Source (LogIndex int, UserID nvarchar (10), LogTime datetime, Tipo smallint);

    CREATE TABLE #Temp (LogIndex int, UserID nvarchar...

  • RE: CASE in WHERE clause

    Gail's blog recommends using dynamic SQL

    but our boss doesn't like it at all.

    Is your boss SQL Server professional or just an idiot with a lot of ambitions?

    For what you're...

  • RE: Stored Procedure runs slower than SQL Query Why??

    david.ostrander (3/13/2013)


    Hello -

    I created a Store Procedure to have Table A sync with Table B by doing an insert of the data that it does not have.

    The issue I'm...

  • RE: Split A String into 4 parts

    declare @filename varchar(100)

    set @filename = 'Notes_20130204_003015.txt';

    select PARSENAME(replace(@filename,'_','.'),4)

    select PARSENAME(replace(@filename,'_','.'),3)

    select PARSENAME(replace(@filename,'_','.'),2)

    select PARSENAME(replace(@filename,'_','.'),1)

  • RE: Complex SQL QUERY with DateDIFF

    ChrisM@Work (3/13/2013)


    Eugene Elutin (3/13/2013)


    Still running after 12 minutes.

    Some one around was looking for CPU killer query... I need to cancel that one!

    Hahahaha!

    I didn't say it would be faster, but...

  • RE: Complex SQL QUERY with DateDIFF

    Still running after 12 minutes.

    Some one around was looking for CPU killer query... I need to cancel that one!

  • RE: Complex SQL QUERY with DateDIFF

    Let's try on 1,000,000 rows:

    common test data setup parts:

    SET DATEFORMAT dmy;

    CREATE TABLE #Source (LogIndex int, UserID nvarchar (10), LogTime datetime, Tipo smallint);

    CREATE TABLE #Temp (LogIndex int, UserID nvarchar (10), LogTime...

  • RE: Complex SQL QUERY with DateDIFF

    Yep, that is right now.

    And it does look less code. But...

    Cause it's based on recursive CTE and hidden triangular join (via cross apply), it's performance very unlikely be on...

  • RE: Complex SQL QUERY with DateDIFF

    ChrisM@Work (3/13/2013)


    Eugene Elutin (3/13/2013)


    I'm sure you didn't mark rows to be "ok" for UserId 01552 correctly, please check carefully!

    01552 is correct, 01551 is incorrect:

    ;WITH OrderedData AS (

    SELECT *, seq =...

  • RE: Complex SQL QUERY with DateDIFF

    I'm sure you didn't mark rows to be "ok" for UserId 01552 correctly, please check carefully!

    SELECT IDENTITY(INT,1,1) RID,*, CAST(NULL AS BIT) AS Flag INTO #Work

    FROM #TEMP ORDER BY UserId,...

Viewing 15 posts - 586 through 600 (of 2,894 total)