Forum Replies Created

Viewing 15 posts - 46 through 60 (of 291 total)

  • RE: Sequence of number in a year without an auxiliary table

    Nice!  That works great.  Now I don't have to think as hard

    Since it is completely set based there is no need to...

  • RE: Sequence of number in a year without an auxiliary table

    the "If Exists" check is to only perform the "increment update" if the incomming value is zero.  This would allow a manual insert of a non-zero value such as 1000 in...

  • RE: Sequence of number in a year without an auxiliary table

    Try this:

    Create trigger tri_gsp_spedizione on gsp_spedizione for Insert as

    begin

     declare @LastVal int

     if exists (select 1 from inserted where val_numspedizione = 0)

     begin

      select @LastVal = Coalesce(Max(g.val_numspedizione),0)

        from gsp_spedizione g join inserted i...

  • RE: Sequence of number in a year without an auxiliary table

    I'm sure there is a more efficient way and someone will probably post it, but to get started I would create and "After Insert" trigger.  The trigger can first determine...

  • RE: Sheath the Talons

    I was in federal law enforcement for 15 years, and often felt my hands were tied when it came to catching criminals.  It seemed that criminals had all the "rights" and...

  • RE: Variable Declaration Problem in Table UDF

    Oh, sorry, didn't see the RETURN after your comments.  Move the "END" statement below the "RETURN" statement.

     

    James.

  • RE: Variable Declaration Problem in Table UDF

    put a "Begin" after the "AS" cluase:

    and remove the "Begin" statement above the first insert.

    Don't forget to RETURN your table, which doesn't appear to be in the FUNCTION.

     

    James.

  • RE: JOINS based on two possible ids?

    if the result needs to look exactly like table 2 then simply select everything from table 2.  No need for a join at all.  Please post an "EXACT" list of...

  • RE: JOINS based on two possible ids?

    Excellent!  I like the eloquence of your join statement.  I'm curious if it is also more efficient or do the functions take a toll?  I've never put one together that...

  • RE: JOINS based on two possible ids?

    It would have been more helpful if you had provided example data for both tables and the output you were looking for (ie. the result set).  But based on my...

  • RE: The Price of Time

    I have to agree with Steve on this one.  It is the "convenience" I'm paying for.  The convenience of having my documents compatible with 99% of the business users out...

  • RE: Case...Including all nulls

    The case statements are all fine and have nothing to do with NULLs not being pulled during the query.  This will depend on the Join statement (if multiple tables) and...

  • RE: Insert Identity field

    Don't reference the Identity column in the insert statement and the DB will automatically assign the next value available. 

    Create table t1 (col1 int identity not null, col2 int)

    then...

  • RE: Question of the Day for 22 Aug 2007

    Actually according to the documentation leading and trailing spaces are supported, only non-printing white space is not supported:

  • Zero or more leading and trailing spaces or tab stops. For example, the...
  • RE: Question of the Day for 22 Aug 2007

    I thought so at first also but if you read each answer carefully you see that of the two dealing with leading and trailing spaces, one specifically mentions "White Space" and...

  • Viewing 15 posts - 46 through 60 (of 291 total)