What is wrong with this insert query?

  • Hi all,

    I have a query like this:

    insert into tableA

    select '7',id,'appname',url,getdate()

    from tableB

    TableA has 5 columns. When I run the query it shows 177 rows affected, but nothing is inserted.

    Thank you.

  • Any triggers on the table?

    Or possibly a rollback command later in the script?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I am running just this insert statement manually. There are no triggers on either tables.

    Thanks.

  • How are you determining that the rows aren't there? A separate query?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Select * from databasename.dbo.tableA

    Thanks.

  • Ah! stupid me. The query actually had top 1000. When I took that out, the records were there. Thanks for your time.

  • Makes sense. You're welcome.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 7 posts - 1 through 6 (of 6 total)

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