Inserting Multiple Times Issue

  • Dear all

    I'm trying to insert the following data from a table called aa_updMobile:

    ContactidMobilePhoneNumberType

    11094507590 0636313

    11096207768 8946733

    11097607710 657 6033

    11099007802 327 6063

    11100307871 4679333

    11101707951 4063363

    11102107810 698 3983

    11102307740 882 2103

    11103007765 9637743

    11103607718 5365563

    11103707718 536 5563

    11103807718 536 5563

    11104307970 7275783

    11104707974 762 4403

    11105007976 659 9133

    11106507802 327 1223

    11107907871 467 9333

    11108307850 4968003

    11108407850 496 8003

    1110930771 86042133

    1110940780 10189443

    11110007771 4683353

    11110107771 4683353

    11110307762 2117223

    11110507811 9611593

    11111307740 7639933

    11111907789 2046163

    11112707740 7639993

    11112807740 7639943

    11113007980 292 0643

    11113607973 121 5153

    11114407900 437 5303

    11114607860 253 8303

    11114707860 253 8303

    into this table called ContactPhone:

    IF NOT EXISTS

    (SELECT *

    FROM sys.objects

    WHERE object_id = object_id (N'[dbo].[ContactPhone]') AND type IN (N'U'))

    BEGIN

    CREATE TABLE [dbo].[ContactPhone]

    (

    [ContactId] INT NOT NULL

    ,[PhoneNumTypeId] SMALLINT NOT NULL

    ,[PhoneNumber] VARCHAR (120) NULL

    ,[PhoneNumberClean] VARCHAR (50) NULL

    ,[EmployeeId] INT NOT NULL

    ,[IsDefault] BIT NOT NULL

    ,[RowGuid] UNIQUEIDENTIFIER ROWGUIDCOL NULL

    )

    ON [PRIMARY]

    WITH (DATA_COMPRESSION = NONE);

    END;

    GO

    But each time i Parse the following query to insert the data:

    INSERT INTO contactphone (contactid, phonenumber, PHONENUMTYPEID )

    SELECT upd.contactid, upd.mobile, PHONENUMBERTYPE

    FROM aa_updmobile upd

    GO

    The results windows says 102 rows affected even though if i actually run the query only 34 records would actually be inserted which is what is expected?

  • Any triggers on the table?

    -- Gianluca Sartori

  • Now it's making sense!

    Trigger window attached, many thanks for the heads up!! 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply