Forum Replies Created

Viewing 15 posts - 346 through 360 (of 771 total)

  • RE: Stored procedure error

    "You have a data mismatch between what your attempting to insert into the table, and what the table expects"

    hum?

    where?

  • RE: Distinct

    WHAT ARE CTE's?

  • RE: Distinct

    maybe you can help me with this too:

    IF I do a select like:

    (SELECT

    [NIF_ANTIGO],

    [NIF],

    [FILIAL_NUMBER],

    [STATUS],

    [COD_GRP_CONTRIBUINTE],

    [COD_TP_SINGULARES],

    [COD_MET_TRIBUTARIO],

    [COD_TP_IMPOSTOS],

    [GRANDE_CONTRIBUINTE],

    [NOME],

    [MORADA],

    [COD_CIDADE],

    [C_POSTAL],

    [TELEFONE],

    [FAX],

    [COD_PROVINCIA],

    [COD_MUNICIPIO],

    [COD_REP_FISCAL],

    [DT_INICIO],

    [DT_ALTERACAO],

    [DT_CESSACAO],

    [COD_MOT_CESSACAO],

    [MOT_CESSACAO],

    [COD_TP_INSTITUICAO],

    [COD_FUNC],

    [COD_COMUNA],

    [COD_BAIRRO],

    [OBS],

    [DT_BEGIN],

    [BI],

    [OLD_NIF],

    [PSERVTCO],

    [PSERVTCP],

    [PSERVA],

    [DTACESSACAOTCO],

    [DTACESSACAOTCP],

    [DTACESSACAOA]

    FROM

    (SELECT

    rn = ROW_NUMBER() OVER(PARTITION BY NIF_ANTIGO ORDER BY Cod_Bairro),

    [NIF_ANTIGO],

    [NIF],

    [FILIAL_NUMBER],

    [STATUS],

    [COD_GRP_CONTRIBUINTE],

    [COD_TP_SINGULARES],

    [COD_MET_TRIBUTARIO],

    [COD_TP_IMPOSTOS],

    [GRANDE_CONTRIBUINTE],

    [NOME],

    [MORADA],

    [COD_CIDADE],

    [C_POSTAL],

    [TELEFONE],

    [FAX],

    [COD_PROVINCIA],

    [COD_MUNICIPIO],

    [COD_REP_FISCAL],

    [DT_INICIO],

    [DT_ALTERACAO],

    [DT_CESSACAO],

    [COD_MOT_CESSACAO],

    [MOT_CESSACAO],

    [COD_TP_INSTITUICAO],

    [COD_FUNC],

    [COD_COMUNA],

    [COD_BAIRRO],

    [OBS],

    [DT_BEGIN],

    [BI],

    [OLD_NIF],

    [PSERVTCO],

    [PSERVTCP],

    [PSERVA],

    [DTACESSACAOTCO],

    [DTACESSACAOTCP],

    [DTACESSACAOA]

    FROM

    BULK_CONTRIBUINTES_21...

  • RE: Distinct

    thank you very very much.

    Excellent solution!

  • RE: Distinct

    It Does not matter what is the value, but it most be a value from the field

  • RE: Distinct

    Because I need a value for the filed.

    For example:

    the cod_bairro can be 1, 2, 3, .....

    I need one of this values.

  • RE: Distinct

    "How do you decide which row to pick"

    The records are like:

    NIF_antigo ; NIF; Olther Fields; Cod_Bairro

    00000001 1 1 ...

  • RE: Distinct

    I have seens that they have only a diferente value. It's the cod_bairro. It the three records only this field has diferente values....

    How can I return a distinct NIF_antigo...

  • RE: Procedure error message

    or this piece of code:

    IF (@MaxTotalidade > @MaxDiferenca)

    BEGIN

    IF (select count(sessaofim) from FicheirosImportar where

    sessaoinicio <> 'T' and sessaofim > @MaxTotalidade and codrf =''+@codrf+'') <> 0...

  • RE: Procedure error message

    It seems like this happens only when the code enters in the condition:

    IF (select count(sessaofim) from FicheirosImportar where

    sessaoinicio ='T' and sessaofim > @MaxTotalidade

    and sessaofim >...

  • RE: Procedure error message

    IF I do it like you told:

    Declare the variable I receive this error:

    The variable name '@MinVal' has already been declared. Variable names must be unique within a query batch or...

  • RE: query performance

    That was the problem.

    I should had B in one of the places instead of having A in both.

    Thank you very much.

    Problem solved.

  • RE: Try Catch

    and inside the proc 1

    proc 2

    ...

  • RE: Try Catch

    That means that I can do as I told, correct?

    Create a "master" stored procedure which calls the other three like this:

    Create MasterProc

    as

    Begin

    begin try

    Begin Tran

    exec proc 1

    ...

  • RE: Stored Procedure error

    How to make this:

    SET @STRSQL = 'select @val = isnull(CODIGO,0) FROM '+@DB+'.DBO.UTILIZADORES WHERE NOME = ''sgsc'''

    SET @PARMDEFINITION = '@Val INT OUTPUT'

    EXECUTE sp_executesql @STRSQL , @PARMDEFINITION, @val...

Viewing 15 posts - 346 through 360 (of 771 total)