Forum Replies Created

Viewing 15 posts - 781 through 795 (of 4,080 total)

  • RE: Formatting date of birth using South African ID number

    There's a function for what you want: CONVERT()

    select convert(varchar(6),convert(date,'01 Jan 1980'),12)

    select convert(varchar(6),convert(date,'01 Jan 2000'),12)

    The inner CONVERT function turns your string into a DATE character type. The...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    Hey, does anyone realize that in 8-9 days, The Thread will have been running strong for 4 consecutive years now?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Are the posted questions getting worse?

    Just arrived in Seattle. No chest pains, no shortness of breath. So far so good. 😛

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Today's Random Word!

    Feckless

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Needed Temp Table for View

    I've come to use CTE's rather than subqueries, as in the last example, simply because it is easier for me to read from the top down than from inside out.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: char(??) vs varchar(??)

    Important to remember:

    When someone says to use a certain technique because it is better/faster/more economical, make it a point to understand WHY. Blind faith...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Best way to handle Null values

    Cheryl McLaughlin-385812 (10/11/2012)


    It works too a point, but it pulls all the records. If I substitute @Ord_Nbr ='12345' the script still pulls all the records and not the record that...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Best way to handle Null values

    I know, Sean. And I can't understand why that isn't it. It would be nice if the OP came back and told us...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Dynamic TOP query with an option for all records

    Another solution is dynamic SQL. Write the query to return all rows, and then insert your TOP () and ORDER BY as needed.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: A maths puzzle for anyone up for a challenge!

    Is there a reason why you can't just create a table with an identity column and add all your unique value pairs to it? Then you could simply...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Is there a Coalesce LIke function that returns the lowest/highest value of a set of params passed to it

    Or did you mean to do something like this?

    declare @datetimes table (ID int identity(1,1), date1 datetime, date2 datetime)

    insert into @datetimes

    select '11/03/2011','12/01/2012'

    union all

    select '11/03/2011','10/01/2011'

    select MAX(case when Date1 >= Date2 then date1...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Is there a Coalesce LIke function that returns the lowest/highest value of a set of params passed to it

    You originally were talking about four dates, so that's how we wrote the functions.

    Inline table valued functions can be implemented with a CROSS APPLY, like so.

    declare @datetimes...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Suggestion to avoid Cursor

    My money is on Cadavre's solution.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Need to filter large CTE in Join or where clause

    I feel compelled to post a warning against using such a technique on tables with production-scale volumes. It can lead to poor execution plans. ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: store datatype

    When considering datatypes, its important to remember that smaller is usually better. Using a numeric (2,0) datatype requires 5 bytes to store. Using an INT...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 781 through 795 (of 4,080 total)