stored procedure

Results 1 to 2 of 2

Thread: stored procedure

  1. #1
    Join Date
    Dec 1969

    Default stored procedure

    I am trying to compare/write record to database using stored procedure to execute query and recordset object to write record to database. For some reason the stored procedure ends up moving to end of database once executed instead of beginning of database, so I can never make the comparison for an existing record. I would like the stored procedure to start query at first record rather than last record and then write record using recordset object instead of the other way around. Thanks

  2. #2
    Join Date
    Dec 1969


    Hi,<BR><BR>well and this is my understanding of your problem.<BR>check the table if any record found with the matching key.<BR>if found update or else insert.<BR><BR>declare @keyfld int<BR>declare @str varchar(20)<BR>set @str=&#039;select * from table where kfield =&#039;+@keyfld<BR>exec @str<BR>if @@recordcount &#060;&#062; 0 then<BR> &#039;you got some matching record<BR>else<BR> insert<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts