Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. stored procedure ...help!!:)

stored procedure ...help!!:)

Scheduled Pinned Locked Moved Database
databasehelpannouncement
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    coolshad
    wrote on last edited by
    #1

    :)I need to make UPdate stored procedure... like this.. create proc update_user (@user_name nvarchar ,@password nvarchar, @firstname nvarchar ,@lastname nvarchar) update Users set [password]=@password (but if @password=empty string then keep no change in db column "password" ) and update other fields .. thanks

    D N E 3 Replies Last reply
    0
    • C coolshad

      :)I need to make UPdate stored procedure... like this.. create proc update_user (@user_name nvarchar ,@password nvarchar, @firstname nvarchar ,@lastname nvarchar) update Users set [password]=@password (but if @password=empty string then keep no change in db column "password" ) and update other fields .. thanks

      D Offline
      D Offline
      dansoft
      wrote on last edited by
      #2

      Retrieving old password and keep it in a variable or session. use the condition stmt in the asp.net. For eg: if txtpass.text="" then cmd.parameter.add("@password",session("pass")) else cmd.parameter.add("@password",txtpass.text) end if Hope this will help to solve your prob.

      1 Reply Last reply
      0
      • C coolshad

        :)I need to make UPdate stored procedure... like this.. create proc update_user (@user_name nvarchar ,@password nvarchar, @firstname nvarchar ,@lastname nvarchar) update Users set [password]=@password (but if @password=empty string then keep no change in db column "password" ) and update other fields .. thanks

        N Offline
        N Offline
        nguyenvhn
        wrote on last edited by
        #3

        Simple way: create procedure update_user @user_name nvarchar(20), @password nvarchar(20), @firstname nvarchar(20), @lastname nvarchar(20) as if @password is null or @password='' update Users set firstname=@firstname, lastname=@lastname where user_name=@username else update Users set firstname=@firstname, lastname=@lastname, password=@password where user_name=@username

        1 Reply Last reply
        0
        • C coolshad

          :)I need to make UPdate stored procedure... like this.. create proc update_user (@user_name nvarchar ,@password nvarchar, @firstname nvarchar ,@lastname nvarchar) update Users set [password]=@password (but if @password=empty string then keep no change in db column "password" ) and update other fields .. thanks

          E Offline
          E Offline
          Erik W
          wrote on last edited by
          #4

          if @password = '' set @password = null update Users set [password] = isnull(@password, [password]) etc.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups