Hai all....
I want to insert a data into the database only if the data is not present already....
If it is i'll just skip the insert statement........
How am i go about it.............
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Feb 2, 2009, 8:30 AM EST
You can use MERGE feature of SQL Server
Check out the below link
http://www.sqlservercurry.com/2008/05/sql-server-2008-merge-statement.html
Thanks -- VJ
Posted Feb 2, 2009, 6:46 PM EST
But i beleive the option is for sql server 2008....But i am using sql server 2005.....
How am i go about it.........
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Feb 5, 2009, 10:02 AM EST
Hi
Check out the below link
http://sqlserver-tips.blogspot.com/2006/09/mimicking-merge-statement-in-sql.html
Thanks
Vijaya Kadiyala
http
://dotnetvj.blogspot.comVijaya KadiyalaRank #1,085 · 1.8K reputationPosted Feb 5, 2009, 10:02 AM EST
Hi
Check out the below link
http://sqlserver-tips.blogspot.com/2006/09/mimicking-merge-statement-in-sql.html
Thanks
Vijaya Kadiyala
http
://dotnetvj.blogspot.comLen La Sala20 reputationPosted Feb 9, 2009, 2:39 PM EST
Just another way to do it
LisaRank #8,652 · 218 reputationPosted Feb 16, 2009, 11:42 PM EST
why complicating using merge
you can always check for the record in the database based on id, name ... if found leave it else insert into the database
Thanks,
Lisa
Vijaya KadiyalaRank #1,085 · 1.8K reputationPosted Feb 19, 2009, 6:44 AM EST
Hi
With MERGE you can avoid lot of coding around this. Yes simple thing is using Select but you need to place this logic in T-SQL block in order meet his requirement. If we go with MERGE then its not required to have it in T-SQL.
Thanks
Vijaya Kadiyala
Http
://dotnetvj.blogspot.com