将旧数据存储在同一表的一列中并更新另一列中的新数据
我不是专业程序员,而是需要帮助的爱好者。这是我的挑战:
我有一个充满员工数据的表。
目前,我们的任何员工都可以转到我们网站上的“更新”网页,然后在文本框中显示的旧姓氏上输入他的新姓氏然后单击“提交”,他的姓氏将在数据库中更新。但是,我的主管希望将员工的旧姓氏与新姓氏保留在同一个表中。她的想法是,当员工在文本框中输入他的新姓氏时,它将触发数据库将他的以前姓氏存储在名为“别名”的列中,然后在“姓氏”列中更新他的新姓氏。我该如何继续呢?
以下是表格的结构:
PeopleID (int)
JobIDNum (int)
EmployeeIDNum (varchar(25))
Email (varchar(100))
Password (varchar(50))
LastName (varchar(50))
FirstName (varchar(25))
Deleted (char(1))
Alias (varchar(50))
我感谢我能得到的任何帮助和/或建议。
I'm not a professional programmer but an enthusiast who needs help. Here is my challenge:
I have a table full of data for our employees.
Currently, any of our employees can go to the "Update" web page on our web site and type in his new last name over the previous one that is displayed in a textbox and click submit, his last name will be updated in the database. However, my supervisor wants to keep the employees' previous last name in the same table as the new last name. Her idea is when an employee types in his new last name in the textbox, it will trigger the database to store his previous last name in a column called "Alias" and then update his new last name in the "LastName" column. How do I proceed with that?
Here is the structure of the table:
PeopleID (int)
JobIDNum (int)
EmployeeIDNum (varchar(25))
Email (varchar(100))
Password (varchar(50))
LastName (varchar(50))
FirstName (varchar(25))
Deleted (char(1))
Alias (varchar(50))
I appreciate any assistance and/or advice I can get.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
其中
@LastName
是具有new值的参数,@PeopleID
是相应人员的ID。Where the
@LastName
is a parameter with new value,@PeopleID
is a id of corresponding people.尝试这个更新语句:
Try this update statement:
建议您可以从 ASP 调用一个存储过程。
在 ASP 代码中调用此存储过程,如下所示:
Suggest a stored procedure that you can call from ASP.
Call this stored proc in your ASP code like this: