here is store procedure i want to insert primary key value , and the PK is not auto key value, basicaly i want to insert ABCD into Cenmst table in column Cennbr, but 1st time insertion work properly but again i insert ABCD value its give me error you are
insert duplicate value, but i want these ABCD value update on previous ABCD column value, please create update query in this store procedure for me.through if condition, iw want at a time insert value and when duplicate value come then update the value
thanks
--------------------------------------------------- store Procedure here ---------------------------------------------
Create procedure [dbo].[GetData]
(@xmlstr ntext)
as begin
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[TimStp]))AS P
You will need to pull your xml into a temp table like this:
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,timstp
into #temp_xml
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[TimStp]))AS P
Then you will need to verify the existence of the data already in the table and conditionally insert or update based on your results:
INSERT INTO cenmst (cennbr, fulnme, adr1, adr2, ctynme, stecde, zipcode, telnbr, faxnbr, timstp)
SELECT t.*
FROM #temp_xml t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr
WHERE c.cennbr IS NULL
UPDATE cenmst
SET fulnme = t.fulnme,
adr1 = t.adr1,
adr2 = t.adr,
ctynme = t.ctynme,
stecde = t.stecde,
zipcode = t.zipcode,
telnbr = t.telnbr,
faxnbr = t.faxnbr,
timstp = t.timstp
FROM #temp_xml t
JOIN cenmst c
ON t.cennbr = c.cennbr
This will insert new values and update existing ones. If your xml only contains one row, you could do this a little differently, but this code is more versatile for 1+ rows. I haven't verified that this code compiles or runs, but use it as a guide.
"What I hear, I forget; What I see, I remember; What I do, I understand." --Confucius
Remeber to Mark as Answer if this post helped you.
(@xmlstr ntext)
as begin
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],TimStp
into cenmst
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[upddte],[updtim],[updusr],[timestamp],[TimStp]))AS P
INSERT INTO cenmst (cennbr, fulnme, adr1, adr2, ctynme, stecde, zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp], timstp)
SELECT t.*
FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr
WHERE c.cennbr IS NULL
UPDATE t SET fulnme = t.fulnme, adr1 = t.adr1, adr2 = t.adr2, ctynme = t.ctynme, stecde = t.stecde,
zipcde = t.zipcde, telnbr = t.telnbr, faxnbr = t.faxnbr, upddte =t.upddte ,updtim= t.updtim, updusr = t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr
EXEC sp_xml_removedocument @hDoc
end
tell me please how to put where conditions in update query and how to update one record in row, becasue that update query update all table record, and when i can debug the code, the error message come with me e.g
There is already an object named 'cenmst' in the database. please fized that issue for me,
That update should update all the rows that you included in your xml. If you want to filter which rows it updates, you need to either pull them out of the xml or hardcode another where statement in the update.
"What I hear, I forget; What I see, I remember; What I do, I understand." --Confucius
Remeber to Mark as Answer if this post helped you.
Violation of PRIMARY KEY constraint 'PK_cenmst'. Cannot insert duplicate key in object 'dbo.cenmst'
ALTER procedure [dbo].[GetDatanew]
(@xmlstr ntext,
@cennbr char(6) = NULL)as BEGIN
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[UpdDte],[UpdTim],[UpdUsr],[TimeStamp],[TimStp]))AS P
SELECT t.* FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr WHERE c.cennbr IS NULL
UPDATE t SET fulnme=t.fulnme, adr1=t.adr1, adr2=t.adr2, ctynme=t.ctynme, stecde=t.stecde,
zipcde=t.zipcde, telnbr=t.telnbr, faxnbr= t.faxnbr, upddte=t.upddte, updtim=t.updtim, updusr=t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr where t.cennbr=@cennbr
EXEC sp_xml_removedocument @hDoc
You only implemented a part of my solution. You still have the underlying problem of trying to insert all of your xml each time. Implement the full solution I provided earlier and you should no longer receive the duplicate key error.
"What I hear, I forget; What I see, I remember; What I do, I understand." --Confucius
Remeber to Mark as Answer if this post helped you.
************************************** code of CS **************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Text;
using System.Configuration;
using System.Xml.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
SqlConnection con;
SqlDataAdapter adap;
DataSet ds, ds1;
string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
[WebMethod]
public DataSet webservices()
{
con = new SqlConnection(@"Data Source=ZUBAIRKHALIL;Initial Catalog=plrmaa;Integrated Security=True;MultipleActiveResultSets=True");
ds = new DataSet();
ds.ReadXml(Server.MapPath("MDEMO_data.xml"));
string strxml = XDocument.Load(Server.MapPath("MDEMO_data.xml")).ToString();
SqlConnection sqlconn = new SqlConnection(connStr);
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Connection = sqlconn;
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.CommandText = "GetDatanew";
sqlcmd.Parameters.AddWithValue("@xmlstr", strxml);
sqlconn.Open();
sqlcmd.ExecuteNonQuery();
sqlconn.Close();
adap = new SqlDataAdapter("select * from CenMst", con);
ds1 = new DataSet();
adap.Fill(ds1, "CenMst");
return ds1;
****************************************** store Procedure **********************************************
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create procedure [dbo].[GetDatanew]
(@xmlstr ntext,
@cennbr char(6) = NULL)as BEGIN
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[UpdDte],[UpdTim],[UpdUsr],[TimeStamp],[TimStp]))AS P
SELECT t.* FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr WHERE c.cennbr IS NULL
UPDATE t SET fulnme=t.fulnme, adr1=t.adr1, adr2=t.adr2, ctynme=t.ctynme, stecde=t.stecde,
zipcde=t.zipcde, telnbr=t.telnbr, faxnbr= t.faxnbr, upddte=t.upddte, updtim=t.updtim, updusr=t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr where t.cennbr=@cennbr
EXEC sp_xml_removedocument @hDoc
END
so you try on ur system then easy for you
thanks for help me
its urgent task,othervise the company will terminate me
zubair258
Member
112 Points
129 Posts
how to update primary key value using update query its not auto key
Dec 19, 2012 06:30 PM|LINK
here is store procedure i want to insert primary key value , and the PK is not auto key value, basicaly i want to insert ABCD into Cenmst table in column Cennbr, but 1st time insertion work properly but again i insert ABCD value its give me error you are insert duplicate value, but i want these ABCD value update on previous ABCD column value, please create update query in this store procedure for me.through if condition, iw want at a time insert value and when duplicate value come then update the value
thanks
--------------------------------------------------- store Procedure here ---------------------------------------------
Create procedure [dbo].[GetData]
(@xmlstr ntext)
as begin
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[TimStp]))AS P
EXEC sp_xml_removedocument @hDoc
end
grundebar
Contributor
4515 Points
726 Posts
Re: how to update primary key value using update query its not auto key
Dec 19, 2012 06:50 PM|LINK
You will need to pull your xml into a temp table like this:
Then you will need to verify the existence of the data already in the table and conditionally insert or update based on your results:
INSERT INTO cenmst (cennbr, fulnme, adr1, adr2, ctynme, stecde, zipcode, telnbr, faxnbr, timstp) SELECT t.* FROM #temp_xml t LEFT OUTER JOIN cenmst c ON t.cennbr = c.cennbr WHERE c.cennbr IS NULL UPDATE cenmst SET fulnme = t.fulnme, adr1 = t.adr1, adr2 = t.adr, ctynme = t.ctynme, stecde = t.stecde, zipcode = t.zipcode, telnbr = t.telnbr, faxnbr = t.faxnbr, timstp = t.timstp FROM #temp_xml t JOIN cenmst c ON t.cennbr = c.cennbrThis will insert new values and update existing ones. If your xml only contains one row, you could do this a little differently, but this code is more versatile for 1+ rows. I haven't verified that this code compiles or runs, but use it as a guide.
Remeber to Mark as Answer if this post helped you.
adamturner34
Contributor
3964 Points
999 Posts
Re: how to update primary key value using update query its not auto key
Dec 19, 2012 06:51 PM|LINK
Duplicate post?
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: how to update primary key value using update query its not auto key
Dec 19, 2012 06:55 PM|LINK
As long as the value is unique, what difference does it make what it is?
zubair258
Member
112 Points
129 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 12:14 PM|LINK
ALTER procedure [dbo].[GetDatanew]
(@xmlstr ntext)
as begin
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],TimStp
into cenmst
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[upddte],[updtim],[updusr],[timestamp],[TimStp]))AS P
INSERT INTO cenmst (cennbr, fulnme, adr1, adr2, ctynme, stecde, zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp], timstp)
SELECT t.*
FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr
WHERE c.cennbr IS NULL
UPDATE t SET fulnme = t.fulnme, adr1 = t.adr1, adr2 = t.adr2, ctynme = t.ctynme, stecde = t.stecde,
zipcde = t.zipcde, telnbr = t.telnbr, faxnbr = t.faxnbr, upddte =t.upddte ,updtim= t.updtim, updusr = t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr
EXEC sp_xml_removedocument @hDoc
end
tell me please how to put where conditions in update query and how to update one record in row, becasue that update query update all table record, and when i can debug the code, the error message come with me e.g
grundebar
Contributor
4515 Points
726 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 03:02 PM|LINK
That update should update all the rows that you included in your xml. If you want to filter which rows it updates, you need to either pull them out of the xml or hardcode another where statement in the update.
Remeber to Mark as Answer if this post helped you.
zubair258
Member
112 Points
129 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 04:50 PM|LINK
i Use that code but give me that error,
ALTER procedure [dbo].[GetDatanew]
(@xmlstr ntext,
@cennbr char(6) = NULL)as BEGIN
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[UpdDte],[UpdTim],[UpdUsr],[TimeStamp],[TimStp]))AS P
SELECT t.* FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr WHERE c.cennbr IS NULL
UPDATE t SET fulnme=t.fulnme, adr1=t.adr1, adr2=t.adr2, ctynme=t.ctynme, stecde=t.stecde,
zipcde=t.zipcde, telnbr=t.telnbr, faxnbr= t.faxnbr, upddte=t.upddte, updtim=t.updtim, updusr=t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr where t.cennbr=@cennbr
EXEC sp_xml_removedocument @hDoc
END
grundebar
Contributor
4515 Points
726 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 05:23 PM|LINK
You only implemented a part of my solution. You still have the underlying problem of trying to insert all of your xml each time. Implement the full solution I provided earlier and you should no longer receive the duplicate key error.
Remeber to Mark as Answer if this post helped you.
zubair258
Member
112 Points
129 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 05:45 PM|LINK
i want to insert value of xml file its work corectly first time but when i want to insert next time same value its give me that error
so i want to insert again & again same value or replace another value on same value
************************** here is XML file ************************************
<mDoc>
<mTrans id="Transfer Request">
<mSet id="WbrTransfer">
<mRow id="CenMst">
<mCol id="CenNbr">Mw</mCol>
<mCol id="FulNme">As</mCol>
<mCol id="Adr1n">Cs</mCol>
<mCol id="Adr2n">ASDAS</mCol>
<mCol id="CtyNme">Aa</mCol>
<mCol id="SteCde">GD</mCol>
<mCol id="ZipCde">19406</mCol>
<mCol id="TelNbr">(610)265-6606</mCol>
<mCol id="FaxNbr">(610)337-6107</mCol>
<mCol id="UpdDte">s</mCol>
<mCol id="UpdTim">s</mCol>
<mCol id="UpdUsr">s</mCol>
<mCol id="TimeStamp">121</mCol>
<mCol id="TimStp">1280</mCol>
</mRow>
</mSet>
</mTrans>
</mDoc>
**********************************************
table script ************************
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[cenmst](
[cennbr] [char](6) NOT NULL,
[fulnme] [char](36) NULL,
[adr1] [char](36) NULL,
[adr2] [char](36) NULL,
[ctynme] [char](20) NULL,
[stecde] [char](2) NULL,
[zipcde] [char](10) NULL,
[telnbr] [char](14) NULL,
[faxnbr] [char](14) NULL,
[upddte] [char](8) NULL,
[updtim] [char](8) NULL,
[updusr] [char](6) NULL,
[timestamp] [int] NULL,
[timstp] [int] NULL,
CONSTRAINT [PK_cenmst] PRIMARY KEY NONCLUSTERED
(
[cennbr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
************************************** code of CS **************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Text;
using System.Configuration;
using System.Xml.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
SqlConnection con;
SqlDataAdapter adap;
DataSet ds, ds1;
string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
[WebMethod]
public DataSet webservices()
{
con = new SqlConnection(@"Data Source=ZUBAIRKHALIL;Initial Catalog=plrmaa;Integrated Security=True;MultipleActiveResultSets=True");
ds = new DataSet();
ds.ReadXml(Server.MapPath("MDEMO_data.xml"));
string strxml = XDocument.Load(Server.MapPath("MDEMO_data.xml")).ToString();
SqlConnection sqlconn = new SqlConnection(connStr);
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Connection = sqlconn;
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.CommandText = "GetDatanew";
sqlcmd.Parameters.AddWithValue("@xmlstr", strxml);
sqlconn.Open();
sqlcmd.ExecuteNonQuery();
sqlconn.Close();
adap = new SqlDataAdapter("select * from CenMst", con);
ds1 = new DataSet();
adap.Fill(ds1, "CenMst");
return ds1;
}
}
here is sevice.asmx file code
<%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" class="Service" %>
here is web config file code
<connectionStrings >
<add name="myConnectionString" connectionString="Data Source=ZUBAIRKHALIL;Initial Catalog=plrmaa;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>
</connectionStrings >
****************************************** store Procedure **********************************************
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create procedure [dbo].[GetDatanew]
(@xmlstr ntext,
@cennbr char(6) = NULL)as BEGIN
declare @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@xmlstr
insert into cenmst (cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp)
select cennbr, fulnme, adr1, adr2, ctynme ,stecde , zipcde, telnbr, faxnbr,upddte,updtim,updusr,[timestamp],timstp
from (SELECT * FROM OPENXML(@hDoc, '/mDoc/mTrans/mSet/mRow/mCol', 1)
WITH ( id VARCHAR(11),VALUE VARCHAR(50) 'text()')) as sourceTable pivot (min(value) for id
in ([CenNbr],[FulNme],[Adr1],[Adr2],[CtyNme],[SteCde],[ZipCde],[TelNbr],[FaxNbr],[UpdDte],[UpdTim],[UpdUsr],[TimeStamp],[TimStp]))AS P
SELECT t.* FROM cenmst t
LEFT OUTER JOIN cenmst c
ON t.cennbr = c.cennbr WHERE c.cennbr IS NULL
UPDATE t SET fulnme=t.fulnme, adr1=t.adr1, adr2=t.adr2, ctynme=t.ctynme, stecde=t.stecde,
zipcde=t.zipcde, telnbr=t.telnbr, faxnbr= t.faxnbr, upddte=t.upddte, updtim=t.updtim, updusr=t.updusr,
[timestamp]= t.[timestamp],timstp = t.timstp
FROM cenmst t JOIN cenmst c ON t.cennbr = c.cennbr where t.cennbr=@cennbr
EXEC sp_xml_removedocument @hDoc
END
so you try on ur system then easy for you
thanks for help me
its urgent task,othervise the company will terminate me
zubair258
Member
112 Points
129 Posts
Re: how to update primary key value using update query its not auto key
Dec 20, 2012 05:55 PM|LINK
i have send you All file code so check by self plz
please do for me its urgent task for me,
thanks sir