We Recommend

SQL Cookbook SQL Cookbook
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.


Posted By

krisdb on 03/08/07


Tagged

sql


Versions (?)


if exists


Published in: SQL 


  1. sql="if exists (select wineclub_usersID from wineclub where wineclub_usersID = " & session("userid") & ") " & _
  2. "begin " &_
  3. "update table set shipemail = '"&StripTicks(session("shipemail"))&"', " &_
  4. "where wineclub_usersID = "&session("userid")&"; " &_
  5. "end else begin " &_
  6. "insert into table " &_
  7. "(wineclub_usersID,shipemail,shipname,shipaddress, shipcity, shipstate)" & _
  8. " values ("&session("userid")&",'"&StripTicks(session("shipemail"))&"') " &_
  9. "end"

Report this snippet 

You need to login to post a comment.