Forum Replies Created

Viewing 15 posts - 391 through 405 (of 1,193 total)

  • RE: Conversion failed when converting date and/or time from character string.

    It's because of the return type of CASE.

    A CASE expression's return data type will be the data type with the highest precedence of all the possible result expressions. See https://msdn.microsoft.com/en-us/library/ms181765.aspx#Anchor_2

    Some...

  • RE: Error in proc

    Most likely in the first environment the conditions that result in the execution of the branch with the ROLLBACK are not being met, while in the second environment those conditions...

  • RE: Are the posted questions getting worse?

    ZZartin (8/25/2016)


    Ed Wagner (8/25/2016)


    Lynn Pettis (8/25/2016)


    Got to the following from a LinkedIn email. Not sure about a few of the answers.

    https://intellipaat.com/interview-question/sql-interview-questions/

    I didn't make it the whole way through, but...

  • RE: LOB data types

    The documentation is incorrect about that for sys.types.

    Pull max_length from sys.columns instead, and it should correctly show -1.

    Cheers!

  • RE: Create Unique identifier from text

    UNIQUEIDENTIFIER only permits hexadecimal digits, and your strings contain many non-hexadecimal characters.

    Exactly what is the goal of turning strings into UNIQUEIDENTIFIERS like this?

    Cheers!

  • RE: Table Row Counts

    Another alternative is to construct a dynamic UNION ALL query by SELECTing from sys.databases.

    Just a quick example of how that might look if my goal is to see all tables...

  • RE: Need Guidance On Query

    drew.allen (8/22/2016)


    Jacob Wilkins (8/22/2016)


    drew.allen (8/22/2016)


    COUNT will work as an aggregate if you return a NULL in the proper cases. COUNT() may not perform the best, but it will work.

    COUNT(CASE...

  • RE: Need Guidance On Query

    drew.allen (8/22/2016)


    COUNT will work as an aggregate if you return a NULL in the proper cases. COUNT() may not perform the best, but it will work.

    COUNT(CASE WHEN status='Discharge' THEN...

  • RE: Need Guidance On Query

    A few things:

    1) You said this was per avatarid/episode combination, so you would need to group by both columns, not just avatarid.

    2) To filter based on aggregates, you should use...

  • RE: stored procedure issue

    drew.allen (8/22/2016)


    Jacob Wilkins (8/22/2016)


    Something like this:

    [column] LIKE '['+@a+'-'+@b+']%'

    Cheers!

    This will only work if you pass in single characters as your parameters. Given that you've defined your parameters as VARCHAR(50), it...

  • RE: stored procedure issue

    To follow up on Luis' fine answer, the reason you're seeing those results is that you're not actually using the parameters you're passing.

    When you do this:

    [column] LIKE '[@a-b]%'

    you're saying to...

  • RE: The effect of nolock on the sort order of a view

    The first point to make is that you should never assume the output of a query will be ordered any particular way unless you use an ORDER BY clause (I'm...

  • RE: Help in understanding begin and end dates what they doing

    There's a table of dates (presumably), dbo.date.

    The first SET command sets the @EndDate variable to be the most recent date from the dbo.date table that is earlier than the current...

  • RE: how to delete part of the history from the log file?

    The shrink will attempt to reclaim space starting at the end of the file, but will not shrink past the part of the log that is active.

    Most likely the active...

  • RE: Interview Questions

    ScottPletcher (6/14/2016)


    My advanced knowledge, "tricky" q is:

    In autocommit mode, when can an UPDATE statement partially complete, some UPDATEs made, some not, where SQL does not roll it back?

    Edit:...

Viewing 15 posts - 391 through 405 (of 1,193 total)