Avatar of JCWEBHOST
JCWEBHOST asked on

database

Hey guys, i have an mdf database and want to know what happens if i insert into a database and the internet cuts off?

the half the information be entered?

or do i need to write a trigger to rollback my transaction?

i am using sql 2008 server where my database is kept.
ASP.NETMicrosoft SQL Server 2008Microsoft SQL Server

Avatar of undefined
Last Comment
JCWEBHOST

8/22/2022 - Mon
Anuj

Do it in a transaction, so that either entire insert get successful or nothing will insert, No partial inserts.
SOLUTION
RiteshShah

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
JCWEBHOST

i am using stored procduers
RiteshShah

But, yes, if you have more than one INSERT statement in one batch, it could be possible that few INSERT statement works and later few wouldn't. in that case, transaction would be helpful
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
JCWEBHOST

how can i prevent that in stored procedures?

on a insert statement.
ASKER
JCWEBHOST

how do i do a transaction in a stored procedure?
RiteshShah

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
barlet

ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
JCWEBHOST

thanks