Forum Replies Created

Viewing 15 posts - 271 through 285 (of 425 total)

  • RE: conditional SQL query based on the column value in table

    if {approval date} is null before {status} is set to 'approved', just use isnull():

    and datediff( day,

    isnull({approval date},getdate()),

    {signature date}) <= {@number of days}

  • RE: Case statement not workin

    alorenzini (3/18/2008)


    Simple is best I used this route:

    ,CASE

    WHEN v.PurchaseAmount/15000 <=1 THEN 0

    ELSE v.PurchaseAmount/15000

    END as 'TotalPersonalSalesCalculatedPoints'

    that simple version doesn't have a sum. i don't know your data (still...

  • RE: Cannot delete rows: the text, ntext, and image...

    does the table have a declared primary key? if not, the interface will attempt to identify the row by qualifying all values. the resulting statement would be something...

  • RE: Case statement not workin

    when numerics are divided, the result is a different sized numeric and it typically has a larger scale than the original value. so numeric(19,2)/int will result in a numeric(25,8)...

  • RE: Instead of trigger for a normalized view using normalized tables

    I'm not sure what you're trying to accomplish. Are this your real table layouts or just a simplified structure for illustration?

    If (6,'44444') is inserted to vDeNorm, its trigger inserts...

  • RE: Select first row of multiple

    what do you mean by "first". first record encountered or first record when sorted by what column(s)?

    the code below should get you started. it will only return the record...

  • RE: Insert Statement

    i gladly admit when someone has a stronger position that me. i enjoy jousting on topics like this.

    😉

  • RE: Insert Statement

    touche! I/O is an important concern that I had not considered.

    Game to miller.

  • RE: Insert Statement

    again, i see your point, but @@identity (or scope_identity()) used properly can still be used to produce the same results. true, there is an @@identity gotcha but it can...

  • RE: Insert Statement

    i see you point, but the script that performs the action can collect the contents of inserted/deleted by "select ... from ... where {criteria used to perform the action}" before...

  • RE: Insert Statement

    ah... DEFAULT VALUES. i figured there had to be some way to do it, but never had the need before so i was unaware.

    however, why use the...

  • RE: Insert Statement

    i don't know how to insert a row into a table whose only column is an identity column. you could add another column to it like so:

    alter table table1...

  • RE: Help with Update Query

    the update in my prior post will do step #1. it's easily modified to do step #2.

    --update name

    -- set name.email = other.email

    select name.email,

    other.email as other_email,...

  • RE: Multi Level Count in TSQL

    i'm a bit confused by your post since you say you want a count for union and job, but your select has no count() and appears to list jobs and...

  • RE: Help with Update Query

    Mike Feuti (3/11/2008)


    Right sorry about that. The select statement is:

    select preferred_mail, name.email, name_address.email,purpose from name,name_address

    where name.id=name_address.id

    and name.id='405691'

    I accidentaly said the 'other' purpose instead of the 'home' purpose in...

Viewing 15 posts - 271 through 285 (of 425 total)