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 |
ravininave
Posting Yak Master
111 Posts |
Posted - 2014-07-11 : 06:37:25
|
Hello, I've a table with following structureTable Name:ApplicationsAppID intAppCode nvarchar(12)SponsorCode nvarchar(12)INSERT INTO Applications (AppID,AppCode,SponsorCode) VALUES (10,'A1','A1')INSERT INTO Applications (AppID,AppCode,SponsorCode) VALUES (10,'B1','A1')INSERT INTO Applications (AppID,AppCode,SponsorCode) VALUES (10,'C1','A1')INSERT INTO Applications (AppID,AppCode,SponsorCode) VALUES (10,'D1','B1')INSERT INTO Applications (AppID,AppCode,SponsorCode) VALUES (10,'E1','C1')So SponsorCode is the sponsor which is actually from the same table previously it was appcode and now sponsorcode. Now we have added 1 more field sponsorID which is the int value i.e. appid. For that I wrote:Update applications set SponsorID= (Select AppID from Applications Where AppCode= SponsorCode ) But It's not getting updated. Can anyone suggest me the correct syntax.VB6/ASP.NET------------------------http://www.nehasoftec.com |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-07-11 : 08:54:11
|
[code]UPDATE Applications SET SponsorID = AppID;[/code] |
|
|
|
|
|
|
|