Execution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeeHarvey
    New Member
    • Mar 2007
    • 9

    Execution

    Hi,

    The sql script i try to execute in c# code fails to insert data in table but no error occurs. If I copy the sql code right before execution and paste it into the management studio it works fine. The script looks something like this.

    create table #tempHolder1(Re cipientID int, SMSMessageQueue ID int)
    create table #tempHolder2(SM SMessageQueueID int, RecipientID int, SMSResponseText nvarchar(32), ResponseDate datetime)

    insert into #tempHolder1 select RecipientID, SmsMessageQueue ID from tSmsMessageSend Info where DestinationNumb er = @mobileNumber
    and SMSMessageQueue ID in (select SMSMessageQueue ID from tSMSMessageQueu e where IRP = @irpID)

    insert into #tempHolder2 (SMSMessageQueu eID, RecipientID)
    select SMSMessageQueue ID, RecipientID from #tempHolder1

    update #tempHolder2 set SMSResponseText = @smsResponseTex t, ResponseDate = @responseDate

    insert into tSmsResponse (SMSMessageQueu eID, RecipientID, SMSResponseText , ResponseDate)
    select * from #tempHolder2

    drop table #tempHolder1
    drop table #tempHolder2
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    The only reason I can't think of is because of your temp table.I don't know how you executed the entire code, if this is a single batch or one code at a time.

    -- CK

    Comment

    • LeeHarvey
      New Member
      • Mar 2007
      • 9

      #3
      Thanx for the reply. I do it all in one execution.

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Try using a table variable or a physical table instead.

        -- CK

        Comment

        Working...