TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Narasiman nar
NA
64
22.5k
When update duplicate rows inserted
Jun 5 2018 8:29 AM
ALTER
PROCEDURE
[dbo].[sp_update_farmer_registration_web]
@originname
varchar
(100),
@farmerctscode
varchar
(100),
@farmerseason
varchar
(100),
@dateofjoinseco
varchar
(100),
@governmentcode
varchar
(100),
@firstname
varchar
(100),
@lastname
varchar
(100),
@surname
varchar
(100),
@gender
varchar
(100),
@dateofbirth
varchar
(100),
@birthlocation
varchar
(100),
@fathername
varchar
(100),
@mothername
varchar
(100),
@village
varchar
(100),
@currentyearcooperative
varchar
(100),
@phonenumber
varchar
(100),
@observation
varchar
(100),
@nooffarms
varchar
(100),
@productionestimation
varchar
(100),
@otherdetails
varchar
(
max
),
@previouscropsdetails
varchar
(
max
),
@firstlevelapprovalstatus
varchar
(100),
@firstlevelapprovedby
varchar
(100),
@secondlevelapprovalstatus
varchar
(100),
@secondlevelapprovedby
varchar
(100),
@firstlevelcomments
varchar
(
max
),
@secondlevelcomments
varchar
(
max
),
@updatedby
varchar
(100),
@mastertype
varchar
(100)
AS
BEGIN
SET
NOCOUNT
ON
;
DECLARE
@sqlQuery
VARCHAR
(
MAX
)
IF @mastertype =
''
BEGIN
SET
@sqlQuery =
'UPDATE dbo.tbl_farmerregistration_'
+ @originname +
' SET farmerseason = '
''
+ @farmerseason +
''
',
dateofjoinseco =
''
' + @dateofjoinseco + '
''
, governmentcode =
''
' + @governmentcode + '
''
, firstname =
''
' + @firstname + '
''
,
lastname =
''
' + @lastname + '
''
, surname =
''
' + @surname + '
''
, gender =
''
' + @gender + '
''
, dateofbirth =
''
' + @dateofbirth + '
''
,
birthlocation =
''
' + @birthlocation + '
''
, fathername =
''
' + @fathername + '
''
, mothername =
''
' + @mothername + '
''
,
village =
''
' + @village + '
''
, currentyearcooperative =
''
' + @currentyearcooperative + '
''
,
phonenumber =
''
' + @phonenumber + '
''
, observation =
''
' + @observation +'
''
, nooffarms =
''
' + @nooffarms + '
''
, produtionestimation =
''
' + @productionestimation + '
''
,
otherdetails =
''
' + @otherdetails + '
''
,previouscropsdetails =
''
' + @previouscropsdetails + '
''
,
updatedby =
''
' + @updatedby + '
''
, updateddate = GETDATE()
WHERE
farmerctscode =
''
' + @farmerctscode + '
''
'
END
This is the above SP
When i execute the below query as follows
UPDATE
dbo.tbl_farmerregistration_ivorycoast
SET
farmerseason =
'2019'
,
dateofjoinseco =
'2012'
, governmentcode =
'402787J'
, firstname =
'KITCHINDJOUHOU'
,
lastname =
'OUATTARA'
, surname =
'A'
, gender =
'MALE'
, dateofbirth =
'17/5/1981'
,birthlocation =
'FERKESSEDOUGOU'
, fathername =
'OUATTARA MEYERIGUE'
, mothername =
'OSSIELETIAN OUATTARA'
,
WHERE
farmerctscode =
'1050669'
i get output in sql 2 rows affected in a table tbl_farmerregistration_ivorycoast two rows inserted for that farmerctscode = '1050669'
farmerseason dateofjoinseco governmentcode firstname lastname surname gender dateofbirth birthlocation fathername mothername
2019 2012 402787J KITCHINDJOUHOU OUATTARA A MALE 17/5/1981 Ferek Ras Osel
2019 2012 402787J KITCHINDJOUHOU OUATTARA A MALE 17/5/1981 Ferek Ras Osel
how to fix this issue.
please let me know.
Reply
Answers (
3
)
.NET Core and Linux
Select date from sql specified format c#