SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 truncate table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ghostrider
Starting Member

India
11 Posts

Posted - 03/21/2013 :  11:21:54  Show Profile  Reply with Quote
When we truncate the table does the indexes made on them exists in memory??Can we check whether they exist or no???

SwePeso
Patron Saint of Lost Yaks

Sweden
29910 Posts

Posted - 03/21/2013 :  11:53:57  Show Profile  Visit SwePeso's Homepage  Reply with Quote
The indexes are rebuilt too. On disk also.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

ghostrider
Starting Member

India
11 Posts

Posted - 03/21/2013 :  13:34:06  Show Profile  Reply with Quote
quote:
Originally posted by SwePeso

The indexes are rebuilt too. On disk also.



N 56°04'39.26"
E 12°55'05.63"





Thank you sir for your reply but actually I didnt understand what you are trying to convey..Can you elaborate it please??
Go to Top of Page

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1600 Posts

Posted - 03/21/2013 :  19:07:56  Show Profile  Reply with Quote
The indexes exist, just like the table still exists, but the indexes don't refer to any data since there is no data to refer to. Add data to the table and the indexes will act like they are supposed to.

=================================================
There are two kinds of light -- the glow that illuminates, and the glare that obscures. -James Thurber
Go to Top of Page

ghostrider
Starting Member

India
11 Posts

Posted - 03/22/2013 :  11:25:59  Show Profile  Reply with Quote
quote:
Originally posted by Bustaz Kool

The indexes exist, just like the table still exists, but the indexes don't refer to any data since there is no data to refer to. Add data to the table and the indexes will act like they are supposed to.

=================================================
There are two kinds of light -- the glow that illuminates, and the glare that obscures. -James Thurber

So they dont refer to addresess that contained the data before being truncated...or do they point to the addresses??
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3334 Posts

Posted - 03/22/2013 :  12:22:58  Show Profile  Reply with Quote
If your concern is whether there will be orphaned data/rows in the indexes, you do not need to worry about that. When you insert, delete, or update a row from a table (or when you truncate the table) SQL Server updates the indexes automatically as part of the operation in a single transaction. So the table and the indexes will always be in sync.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000