Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-08-09 : 01:39:25
|
| Hi All,I am using this query to update the data from another table..UPDATE usersSET NameGiven = e.NameGiven,NameFamily = e.NameFamily,Username = UPPER(RTRIM(SUBSTRING(e.WindowsUserName,4,100))),Email = e.Email,CompanyID = '002010'FROM juice.dbo.emp eWHERE e.WWID = users.WWID and e.IsActive = 1 ande.WindowsUserName IS NOT NULL and LEN(e.WindowsUserName) > 3its throwing an error Pk_Users primary key can't insert duplicate key.Here Users table is having primary key on Username.Can we restrict the return data bu using above query. |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-08-09 : 01:50:45
|
| http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/06/30/855.aspxtry the linkWith RegardsKashyap M |
 |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-08-09 : 01:58:55
|
| Not exactly mentioned my problem Can somebody help me ? |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
Posted - 2010-08-09 : 02:57:11
|
| check the InsertCommand in your tableAdapter by right click and choose propertiesalso make sure the autoIncrement property for the ID column (inside the dataset) is set to false ,and readonly is set to falsetry thisWith RegardsKashyap M |
 |
|
|
|
|
|