ASSERTION , SUM(POSITION()) in SQL2005

  • All,

    Does SQL2005 support CREATE ASSERTION statement?

    Does Sql2005 support SUM(POSITION()) ?

    I have seen a video on SQLUNIVERSITY.NET. In that video i saw the below code

    SELECT race,

    SUM(POSITION('male' IN sex) AS male_tally,

    SUM(SIGN(ABS(POSITION('female' in sex) AS female_tally

    FROM Personnel

    GROUP BY race;

    karthik

  • Does SQL2005 support CREATE ASSERTION statement?

    >NO, you will need to use CHECK constraint (unfort. a bit different to SQL-92 CREATE ASSERTION idea)

    Does Sql2005 support SUM(POSITION()) ?

    >NO, use CHARINDEX/PATINDEX instead

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • karthikeyan-444867 (5/13/2010)


    SELECT race,

    SUM(POSITION('male' IN sex) AS male_tally,

    SUM(SIGN(ABS(POSITION('female' in sex) AS female_tally

    FROM Personnel

    GROUP BY race;

    That's not SQL Server code. A very quick google search reveals that PostgreSQL supports that function.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply