June 30, 2014 at 8:17 am
DBAs, urgent help please .
1.what is the query , sql command to delete all table data in a database in SQL 2008 standard
2. what is the sql command to shrink the .LDF file if after the data is deleted from the database , still the space is not reduced?
3. is it better to shrink by selecting right click and shrink the database instead of .LDF files once the table is empty?
June 30, 2014 at 8:59 am
rquest7 (6/30/2014)
DBAs, urgent help please .1.what is the query , sql command to delete all table data in a database in SQL 2008 standard
Delete or truncate depending on your requirements.
2. what is the sql command to shrink the .LDF file if after the data is deleted from the database , still the space is not reduced?
Why do you want to shrink the log file? What recovery mode are you using?
3. is it better to shrink by selecting right click and shrink the database instead of .LDF files once the table is empty?
Again, why shrink the log file? I would assume you probably are wanting to shrink the datafile? There are some serious caveats about this. It is ok to shrink once in awhile when you remove lots of data that will not get inserted again. This is NOT something you want to routinely.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 30, 2014 at 9:19 am
I have to say, this really sounds like interview questions. I'm only answering interview questions if I get the job.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 30, 2014 at 9:23 am
Grant Fritchey (6/30/2014)
I have to say, this really sounds like interview questions. I'm only answering interview questions if I get the job.
GAH! Didn't even think about this being interview questions. At least my answers were vague enough that if this person is in an interview they would be asked further clarification and the truth would come out quickly. :w00t:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 30, 2014 at 9:51 am
2. sorry on second question,its .NDF file not .LDF . Can the .NDF be shrunk after all the table data is deleted and or truncated , if the rows still do not get dropped? we have no issues with log files.
what is the command to shrink or reduce the .NDF file?
June 30, 2014 at 10:00 am
Craig G (6/30/2014)
2. sorry on second question,its .NDF file not .LDF .
Pretty sure you mean MDF unless you use your own extensions.
Can the .NDF be shrunk after all the table data is deleted and or truncated , if the rows still do not get dropped?
What does this mean? If the data is deleted has it not been dropped?
what is the command to shrink or reduce the .NDF file?
Have you tried google? Not trying to be a smart a$$ but it is awfully easy to find. Make sure you read about this and understand what you are doing or your next post is going to be asking about performance issues after you did a shrink.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
July 1, 2014 at 4:23 am
Sean Lange (6/30/2014)
Craig G (6/30/2014)
2. sorry on second question,its .NDF file not .LDF .Pretty sure you mean MDF unless you use your own extensions.
No, a secondary database file usually has the .NDF file extension
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
July 1, 2014 at 7:22 am
Perry Whittle (7/1/2014)
Sean Lange (6/30/2014)
Craig G (6/30/2014)
2. sorry on second question,its .NDF file not .LDF .Pretty sure you mean MDF unless you use your own extensions.
No, a secondary database file usually has the .NDF file extension
:blush: Right you are good sir. Thanks for the correction.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply