Stored Procedure in ASP

Results 1 to 2 of 2

Thread: Stored Procedure in ASP

  1. #1
    Join Date
    Dec 1969

    Default Stored Procedure in ASP

    I have a dbf file which has to be Exported to MS SQL 2000. ASP as the front-end as the records will be exported to SQL from the client. <BR>what i currently do is : i take records from the dbf file one by one and insert into the SQl database.<BR>for that i use stored procedure (code below). Here i also check if the record already exist in the SQL Database and if the field1 of table1 exist in the table2.<BR><BR><BR>CREATE PROCEDURE sp_myprocedure<BR>@field1 varchar(25),<BR>@field2 varchar(25),<BR>@field3 varchar(25),<BR>@field4 varchar(25),<BR>@field5 varchar(100),<BR>@field6 varchar(25),<BR>@field7 varchar(25)<BR>AS<BR>if exists(select field1 from table1 where field1=@field1 and field5=@field5) &#039; To Check if record already exit in the table1 &#039;<BR>return 555<BR>else<BR>if exists(select field1 from table2 where field1=@field1) &#039;Check if the field1 Exist in the table2 Table &#039;<BR>insert into table1 (field1,field2,field3,field4,field5,field6,field7) values(@field1,@field2,@field3,@field4,@field5,@fi eld6,@field7)<BR>GO<BR><BR><BR><BR><BR>Even though the records are imported to the SQL from the dbf as per my requirement. <BR><BR><BR>1. How do i count total number of records in the dbf files which already exist in the Table1 and list out the field1 which already exist.<BR>2. How do i list out the field1 in the dbf which is not in the table2 as the records from the dbf files will only be inserted into the table1 if field1 exist in the table2.<BR><BR><BR><BR><BR>Thanx in Advance.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default You have to do it..

    .. all by hand.<BR><BR>And, since your stored procedure only deals with one record at a time, you&#039;re going to need to create a table to hold the information that you want to query.

Posting Permissions

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