NEWBIE, to SQL server, that is

Results 1 to 2 of 2

Thread: NEWBIE, to SQL server, that is

  1. #1
    Paully Guest

    Default NEWBIE, to SQL server, that is

    I want to replace a sql statement in my asp page with a reference to a stored procedure. The problem is that the statement uses the "IN" sql function to determine if a database record (zipcode) is contained within a comma delimited list of possible Zipcodes(dynamically created list based on vicinity to a specific zipcode.<BR><BR>Here is the statement<BR><BR>strSQL = "SELECT Zip, Search_Id, State, City, Company_Name, WorkType1, banner, bold FROM Contractors where (WorkType1 = &#039;"<BR>strSQL = strSQL & WorkType<BR>strSQL = strSQL & "&#039; or WorkType1 = &#039;B&#039;) AND Zip IN (" & Zippy & ") ORDER BY Company_Name"<BR><BR><BR>What would be the stored procedure code???

  2. #2
    Join Date
    Dec 1969

    Default Might want to ask...

    ...this in the Database forum.<BR><BR>But I *believe* that the answer is you&#039;ll have to do it essentially the same way you do it in VBS code. Pass the list in as a string, concatenate it into a string that builds the rest of the query, and then EXEC (or EXECUTE?) the string. Meaning that you just lost most of the advantage of using a Stored Procedure, since the query must be compiled "from scratch".<BR><BR>Unfortunately.<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