Forum Replies Created

Viewing 15 posts - 16 through 30 (of 172 total)

  • RE: Removing or Replacing Data

    If you had a couple of different sanitized examples it would give a better picture. thx

  • RE: Removing or Replacing Data

    While looping through the characters in the row.

    Find the first open bracket, do not include any data until you have went past the closing bracket.

    Note: if the input is...

  • RE: Removing or Replacing Data

    The long and nasty way is to loop through the characters in the data.

    Use loops and find first and last '<', '>'.

    if < & > are not in the actual...

  • RE: Sql Server generic database server RAID setup

    Thanks for the heads up. However, disk Partition Alignment are automatic in Win Server 2008.

    I actually had an infrastructure colleague who would not perform this alignment on my database servers...

  • RE: Determine DB Recovery Model withing Sproc

    Thank you all.

    sys.databases looks like what the doctored ordered. Including information that will be useful for other areas.

  • RE: Converting Oracle SQL statements to SQL 2008

    Yes,

    Instead of doing two sums and then subtracting, the case is setting the credit values to negative and then summing all.

  • RE: Converting Oracle SQL statements to SQL 2008

    The case statement is reversed.

    is

    SELECT CASE WHEN command = 'Credit' then isnull(trans_amount,0) ELSE -1*

    should be

    SELECT CASE WHEN command != 'Credit' then isnull(trans_amount,0) ELSE -1*

  • RE: Converting Oracle SQL statements to SQL 2008

    Not sure why smallMoney is failing, however if you replace smallmoney with decimal (10,2) the results look good.

    CONVERT(DECIMAL(10,2), sum((trans_amount)/100.00), 0)

    The syntax error on the bottom was a missing paren and...

  • RE: How to avoid pulling the same record from the same table

    My first spot to correct would be the Delete from dbo.Reports in utl_applicationReOccurring. I would guess the query above is returning the same reportID for two of your SqlAgent...

  • RE: Converting Oracle SQL statements to SQL 2008

    I think this line is causing your issue

    CONVERT(smallmoney, sum((trans_amount)/100), 0)

    try

    CONVERT(smallmoney, sum((trans_amount)/100.00), 0)

    The value is rounding on the divide before you convert.

    BTW: you didn't like the...

  • RE: Converting Oracle SQL statements to SQL 2008

    Without table structure there may be syntax issues. But the code below should work, and be noticeably faster.

    SELECT CAST(SUM(trans_amount)/100.00 AS DECIMAL(10,2) settle_amt

    FROM

    (

    SELECT CASE command = 'Credit' then isnull(trans_amount,0) ELSE...

  • RE: While...Union

    One possibility is to create a warehouse type of table that is the structure of your tables with an additional column for the source-table-identifier. Then you could have a...

  • RE: Index Management

    Nice article SqlFrenzy!!

    I had an in-database index sproc but I like the additional functionality of needed and unused indexes.

    I am updating the code to run from a Maintenance type database...

  • RE: How to query out duplicate rows (without deleting)

    I would assume it goes here...

    select DISTINCT

    'http://clientzone.redblock.com/' + w.FullURL as ,

    w.Title,

    ui.tp_login,

    wg.Title,

    ud.tp_Created

    FROM ...

    This assumes the same values for title/tp_login/title/tp_created. If that is not true you could use max() on those...

  • RE: How to query out duplicate rows (without deleting)

    Wouldn't

    select DISTINCT yourqueryhere

    remove your duplicates?

Viewing 15 posts - 16 through 30 (of 172 total)