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
 SQL Server Administration (2005)
 truncate table

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-07 : 15:33:56
where can i find the reason why my table is truncate(i dont know how,when,and who did it, i dnot think that application did it)?

thanks

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-07-07 : 16:52:37
Unless you happened to be running a Profiler trace while that occured I think you're out of luck.

ways to avoid this:
- applications and users should not have direct access to your tables.
- Parametized Stored procedures should control changes to your data.
- You can set up Audit tables to track who/when/what made data modifications.

Be One with the Optimizer
TG
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-08 : 01:32:14
how can i make the Audit tables ?

what do you mean "Parametized Stored procedures should control changes to your data"
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-07-08 : 01:39:30
quote:
Originally posted by inbs

how can i make the Audit tables ?

what do you mean "Parametized Stored procedures should control changes to your data"



Audit Table are replica of the Main table, You can write a trigger and insert a row in audit table for each DML operations.



Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-08 : 02:11:33
i want to aviod that table will not be truncate?

could you give me example trigger of DML (What is DML)

thanks
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-08 : 04:06:04
Hi

http://msdn.microsoft.com/en-us/library/ms191524.aspx
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-07-08 : 08:22:25
>>i want to aviod that table will not be truncate
The only way to control that is through a security strategy. In other words you have to use sql server's security features to prevent anyone but the administrators from being able to do that.

Anyone who can connect to your server as a database owner or as SA (system administrator) can do anything they want and there is NOTHING you can do tp prevent that. Who are these users of yours and under what security context do they connect to your sql server(s)? Do you have seperate environments for (production, development, testing, etc)? Does everyone have complete access to all your environments? Do you perform database backups?




Be One with the Optimizer
TG
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-08 : 08:37:44
yea we have test,production enviroments.
i check all what you say.
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-07-09 : 03:39:32
quote:
Originally posted by inbs

i want to aviod that table will not be truncate?

could you give me example trigger of DML (What is DML)

thanks



I strongly advise you to do a training course for sql server 2005.
Please don't take it otherwise...
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-09 : 05:47:43
i take it as compliment, and i still ask questions
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-07-09 : 06:05:15
quote:
Originally posted by inbs

i take it as compliment, and i still ask questions



there isn't any issues in asking questions in public forums...how ever u need to have a basic knowledge to understand the answers posted against your questions....also first search your answers in BOL..then do a google search...and then if u didn't get an answer u can obviously ask questions...
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-09 : 08:03:30
i dont agree with you,
i dont think that my last option is the forum.

Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-07-09 : 08:36:02
quote:
i dont agree with you,
i dont think that my last option is the forum.

Unbelievable!

You're really limiting youself with that practice. You can take any of the questions you asked here:
>> how can i make the Audit tables ?
>> could you give me example trigger of DML
>> What is DML

If you simply type any of those into a google search box you would have pages of answers to select from. In the time it takes one of us to read your question and type a meaningful response you could have already known all you need to about it.

The other problem with asking mindless questions that could be easily answered on your own is that it encourages me (and I'm sure many others here) to just igonre your posts. Why help someone that is unwilling to help themselves?

Finally, Books Online is the single BEST source of Sql Server information there is. You should start to use it.

Be One with the Optimizer
TG
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-07-09 : 09:09:18
quote:
Originally posted by inbs

i dont agree with you,
i dont think that my last option is the forum.



that's really funny....then what's your last option....
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2009-07-09 : 15:40:44
quote:
Originally posted by ahmad.osama

quote:
Originally posted by inbs

i dont agree with you,
i dont think that my last option is the forum.



that's really funny....then what's your last option....



Searching for a different line of work???

Terry

-- Procrastinate now!
Go to Top of Page

tripodal
Constraint Violating Yak Guru

259 Posts

Posted - 2009-07-10 : 15:37:09
I think using a forum is easier than researching in BOL.
I just try not to take it for granted.
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-07-11 : 15:22:31
quote:
Originally posted by tripodal

I think using a forum is easier than researching in BOL.
I just try not to take it for granted.




It's just that people doesn't want to make effort to solve an issue......BOL is a very descriptive help...I find it easier to search BOL...forums are to discuss things related to real life issues and things u r unable to collect from BOL or google...atleast it is good enough to tell u "what is DML"... "what is a trigger"....
Go to Top of Page
   

- Advertisement -