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
 General SQL Server Forums
 New to SQL Server Programming
 How to overwrite file value in the database

Author  Topic 

synoy987
Starting Member

1 Post

Posted - 2009-02-18 : 08:31:20
Hi All

I want to save the contents of a file(any kind) to the database.
Even i have already done it but my problem is when i am modifying something in that file and trying to save, it is creating another row in database.

But i want the previous value should be overwritten withe the modified value.

Anyone plz give some idea or can show a little example by code...

Thanx in advance

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-02-18 : 08:33:52
update tablename
set colname ='newfilename'
where colname ='oldfilename'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-02-18 : 08:35:21
quote:
Originally posted by synoy987

Hi All

I want to save the contents of a file(any kind) to the database.
Even i have already done it but my problem is when i am modifying something in that file and trying to save, it is creating another row in database.

But i want the previous value should be overwritten withe the modified value.

Anyone plz give some idea or can show a little example by code...

Thanx in advance


Post the code you used

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-18 : 09:12:55
If you are running this from a package, why dont you delete and insert if you wish you do not want to change the code you have already written.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-18 : 09:13:03
quote:
Originally posted by synoy987

Hi All

I want to save the contents of a file(any kind) to the database.
Even i have already done it but my problem is when i am modifying something in that file and trying to save, it is creating another row in database.

But i want the previous value should be overwritten withe the modified value.

Anyone plz give some idea or can show a little example by code...

Thanx in advance


it means the logic you're using is not checking for already existing record with same pk upon saving and its doing insert rather than update in those cases.
Go to Top of Page
   

- Advertisement -