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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Inserting into table for specific filed

Author  Topic 

jmodiba
Starting Member

7 Posts

Posted - 2008-10-29 : 05:03:48
am trying to write an insert statement into table but for specific field only where there is a unique primary key to identify please see below my script

insert into SrcHoldingExternal
([units])VALUES
(16098.630000)
and srcholdingexternalid =1871906

karthickbabu
Posting Yak Master

151 Posts

Posted - 2008-10-29 : 05:07:14
You can easily update that field

UPDATE SrcHoldingExternal SET Units = 16098.630000 WHERE srcholdingexternalid = 1871906

================================================

When you realize you've made a mistake, take immediate steps to correct it.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-10-29 : 05:09:19
NB : I think previous poster is right. I think you want an update rather than an insert.


Maybe this


INSERT INTO SrcHoldingExternal (
[units]
)
VALUES 16098.630000


I don't understand what you mean by the line

and srcholdingexternalid =1871906


I can't tell what that relates to from the info you have given.

Maybe you should describe the table and the data you are trying to insert and how you need it all to look at the end of the process?

-------------
Charlie
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 05:12:38
Seems like OP meant an update of record with value 1871906 in which karthickbabu's solution is what OP needs.
Go to Top of Page

jmodiba
Starting Member

7 Posts

Posted - 2008-10-29 : 06:13:07
thanks guys i think it worked chow
Go to Top of Page
   

- Advertisement -