Forum Replies Created

Viewing 15 posts - 10,201 through 10,215 (of 15,381 total)

  • RE: trigger

    I think this should do what you are looking for but it is untested because I don't have ddl to work with.

    create trigger TRG_CONTRIBUINTES_VERIFCA_RF_E_NIF on contribuintes

    for update

    as begin

    update contribuintes

    set nif...

  • RE: trigger

    river1 (10/30/2012)


    The code:

    update

    contribuintes

    set

    nif = c.nif

    from

    contribuintes c

    join

    inserted i

    on

    i.nif_antigo = c.nif_antigo

    where

    i.numeroposto = 'Central'

    Has a problem.

    I want...

  • RE: trigger

    matt.newman (10/30/2012)


    Sorry, trying to do a few things but overall

    declare @insertednif and @deletednif

    select via select

    if insertednif <> deletednif

    begin

    rollback

    return

    end

    no no no. You do not want to use variables like this in...

  • RE: trigger

    river1 (10/30/2012)


    like this:

    update

    contribuintes

    set

    nif = c.nif

    from

    contribuintes c

    join

    deleted d

    on

    d.nif_antigo = c.nif_antigo

    where

    c.numeroposto = 'Central'

    Think you need to set...

  • RE: trigger

    river1 (10/30/2012)


    I think that is what is needed but we have a problem:

    I only want that the trigger acts if the column numeroposto new value is 'Central'. If it's not,...

  • RE: trigger

    Incredibly sparse on details but I think this is close...

    update contribuintes

    set nif = c.nif

    from contribuintes c

    join inserted i on i.PrimaryKey = c.PrimaryKey

    where i.numeroposto = 'Central'

    update contribuintes

    set cod_rep_fiscal = c.cod_rep_fiscal

    from...

  • RE: trigger

    Sean Lange (10/30/2012)


    You have certainly been around here long enough to know that we need ddl and some sample data along with desired results.

  • RE: does temp tables are created unique for each sp call. or will it make a queue on server ?

    From what you described I would imagine you have horrible performance. What does your splitter code look like? Cursors are notoriously horrendous performance hogs and I doubt you actually need...

  • RE: Sum sales for current month

    I am sure that what you posted is very clear for you. Unfortunately we don't know your project or data and we can't see you screen. If you can post...

  • RE: create table variable dynamically

    gsd1 (10/30/2012)


    Thanks for all the replies...

    As Sean Lange suggested, I tried with temp table (instead of temp variable).

    I faced these problems.

    1. I have to build the sql statement. So...

  • RE: trigger

    You have some very serious logic flaws in here. You keep trying to reference your table like a variable and it just doesn't work like that.

    if (contribuintes.NUMEROPOSTO) ='CENTRAL'

    if contribuintes.cod_rep_fiscal not...

  • RE: timestamp field converted to datetime

    Luis Cazares (10/29/2012)


    AFAIK, there's no way to convert a timestamp to datetime because there are no datetime values in the timestamp.

    To avoid confusions, Microsoft has implemented the synonym rowversion.

    Reference:

    http://msdn.microsoft.com/en-us/library/ms182776(v=sql.90).aspx

    Luis is...

  • RE: try..catch and union all

    eugene.pipko (10/29/2012)


    What about any other error? There is no front end. The result is emailed to the user.

    I guess what I am trying to do is to let the other...

  • RE: Alphanumeric number generation

    there are plenty of products around which would perfectly qualify for such codes as CRAP, SH*T and other...

    +100

  • RE: Performance question

    sunny.tjk (10/29/2012)


    Would there be any slowness in performance if a query involves dateadd(day,datediff(day,1,GETDATE()),0) in the WHERE clause?

    There of course is some impact to performance but it is actually pretty minimal...

Viewing 15 posts - 10,201 through 10,215 (of 15,381 total)