Forum Replies Created

Viewing 15 posts - 166 through 180 (of 291 total)

  • RE: Trigger

    Ok, I wanted to make sure.  Yes you need to alter the code I posted as follows:

     DELETE ContactResp

     WHERE kContactNameID IN (SELECT ContactNameID

                                FROM inserted i JOIN deleted d...

  • RE: Trigger

    Sorry, PK is short for "Primary Key" (if the table PK is a composit of two or more columns adjust the join statement accordingly) 

    Since I did not know the...

  • RE: greatest(a,b,...) function

    The nice thing about the second solution is you can implemnt the "Least" function with only a couple of additonal lines of code:

    create function dbo.Least_ (@parmlist_ as varchar(4000))

    returns int

    as

    begin

       ...

  • RE: greatest(a,b,...) function

    While I generally shy away from tokenized string parameters, the following will do what you want without resorting to the sp_exectuesql.

    NOTE: I obtained the "split" function from a script posted...

  • RE: Question of the Day for 05 Jun 2007

    Adam: Guess I should have used the word "accuracy" (either that or learn how to spell! [veracity]).  I'm far from and expert in this area and didn't want to steer...

  • RE: Trigger

    It is my understanding that the if UPDATE(columnname) evalutes to true if any record in the result set had that column modified/inserted.  So your delete statement would include all rows...

  • RE: Question of the Day for 05 Jun 2007

    While I can not vouch for the complete voracity veracity of the information provided at: http://www.sommarskog.se/error-handling-I.html I found the article very informative and useful.  I stumbled accross it while looking...

  • RE: Begin/Commit Transaction question

    Thanks Shawn, wish I could take full credit but all I did was "Find" the answer as it already existed elsewhere.  Credit has to go to Erland Sommarskog who put...

  • RE: Begin/Commit Transaction question

    Hate to do this to you, but it depends on the error, and sometimes the context of the error.  Funny you should ask this today, as it was part of the...

  • RE: greatest(a,b,...) function

    I thought this would be "prettier" than it actually is because I didn't realize that unlike stored procedures, optional parameters in functions can't actually be ignored.  But this might give...

  • RE: truncate table - test data

    If a table is referenced by a subordinate table you can not use the truncate table command even if the subordinate tables are empty.  You will have to use a...

  • RE: truncate table - test data

    Since the relationships are there for a reason you should respect them and delete the subordinate data first.  These relationships prevent you from orphaning data in subordinate tables which would...

  • RE: How do you do a recursive thread on parent/child information

    This solution uses a Common Table Expression (CTE) and it will find all related no matter how deep, though I can't figure out how to make it work using the...

  • RE: How do you do a recursive thread on parent/child information

    Here is a simple solution based on information given.  Doesn't work if more than one level deep.

    --Build our test data

    if object_id('tempdb..#temp_') is not null drop table #temp_

    create table #Temp_ (guid_id...

  • RE: Creative COALESCE()

    Interesting idea, I never considered that possibility.  Thanks for a great example that really helps illustrate the concept.

    James.

Viewing 15 posts - 166 through 180 (of 291 total)