.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How can we reindex single table in s sql server 2008?

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :Sql Server


I have a requirment truncate and reindex the single table,how can we reindex a table?

If we truncate the table,is it necessary to reindex the table(if busines needs).

What is the code for reindex the table in sqlserver2008?




View Complete Post

More Related Resource Links

How to take backup of single table in SQL server 2008 and SQL Server Management Studio Environment



I know how to take total database backup in SQL server 2008 and SQL Server Management Studio Environment but i failed to take single table backup in database.

It is possible to take single table backup in Oracle using PL/SQL Developer IDE.

Thanks in Advance..... 

Under the Table: Programming with FileStreams in SQL Server 2008


There's always been disagreement about whether large blobs, such as document and multimedia items, should be stored in the database or file system. In SQL Server 2008 you don't have to choose; filestream storage provides the best of both approaches.

Bob Beauchemin

MSDN Magazine May 2009

Under The Table: Spatial Data Support In SQL Server 2008


New spatial data support in SQL Server 2008 opens the door to mapping and querying geometric and geographic data, allowing you to build exciting new applications.

Bob Beauchemin

MSDN Magazine February 2009

sql server 2008 Table Partition

HI i want to implement partitioning in my sql server 2008 database table http://blogs.msdn.com/b/manisblog/archive/2009/01/18/easy-table-partitions-with-sql-server-2008.aspx   i have used this link. but when i try this link then i am able to create only primary file group no secondary file group..so help me also by fault i have created partition in wrong table .so i want to detete tha partition from that table but of i delete the PARTITION SCHEME and PARTITION FUNCTION THEN it throws error..so what shoul i do to remove partition from my current table

sql server 2008 Table Partition

HI http://blogs.msdn.com/b/manisblog/archive/2009/01/18/easy-table-partitions-with-sql-server-2008.aspx  i have used  above link to create partition,but my problem is i want to do partition on daily basic, one column in my table is date(by default has getdate()),on the base of this i want to do partition, eg.in this link i need to give time duration between which one can do partition, and also either daily or monthly or quarterly or yearly need to be specify ..if i give date between 01/08/2010 to 01/08/2012 and then select daily wise partition which i am in need then table create more than 700 partion but problem comes when i need to assign group to them how cud i select Primary file group more than 700 times to assign it to each partiotion.it becomes very lengthy process  Please help me

Partitioning a table in SQL Server 2008

Our application has got few tables which has grown to a larger size. Hence one suggestion put forward is to consider table partitioning. Since this does not involve any code changes in the application, we are looking into this option. 1. Is there any disadvantage if we use table partitioning feature 2. Will table partitioning affect the current indexes that exist on the table? 3. Database mirroring is enabled in our schema. Will partitioning have any effect on this? 4. Any suggestion on how we should try this out?  

Find '' in a table in MS SQL SERVER 2008



I need to find white spaces in my table. the table contains 35 columns, therefore, I cannot check with AND or OR operator something like this

SELECT * FROM MS_Exchange_IS WHERE (TMZDIFF != '' AND Timestamp != ''..........)

Also I don't want to use cursors as it will greatly hamper the performance of my application.

Please suggest any other option.


Any link or pointers would be helpful


Thanks in Advance,


Inserting XML into SQL Server 2008 table



I'm generating an XML file from front end, I'm using 4 Data Transfer Object classes comprising of full details of a Customer like CustomerPersonalInfoDTO.cs, CustomerLoginInfoDTO.cs, CustomerPreviousAddressDTO.cs, CustomerAddressInfoDTO.cs.

Everything is fine and XML is also generated, But the problem is with SQL Server Stored Procedure. I've created a table Customer with 20 columns.

CustomerPersonalInfoDTO.cs holds 10 customer fields and CustomerLoginInfoDTO.cs holds another 10 customer fields (total =20)..

I now need to insert at a time these 20 FIELDS into SQL server Customer Table. My XML Data will look like the below:

<?xml version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ?> 
- <CustomerDTO>

- <CustomerPersonalInfo>

Is it possible to save "Collections" to a single varbinary(MAX) field/column in a SQL Server 2008 da


I was thinking about the fastest way to retrieve a "set" of objects related to a specific user. For instance, if I was to create a website similar to Flickr where people upload lots and lots of photos(jpegs) what would be the fastest way to be able to retrieve those photos from the SQL Server database. Scenario 1: You store metadata about each file they upload to the website as a single row in a database table. Then when you want to retrieve a specific users uploaded files you simply scan the database file for every row matching the UserID and store them in memory.

SELECT PictureId, UserId, PathToFile, Caption, (etc.)

FROM Photos

WHERE UserId=@UserId

This, of course, gets all the information about all the photos a single user has uploaded. My concern with this approach is when the user activity goes from a few thousand to being in excess of a million.

This approach seems fine for a small website but does this method work for a million plus user website like Flicker or MySpace? When you have a million users and millions more photos does this approach still perform at acceptable speeds?

My idea was to actually attempt to create a collection in memory of "ALL" the PictureIds' for a single user and store them in-memory, in a collection and then save this collection as a single VARBINARY(MAX) field in the SQL

SQL Server 2008 - Alter Table Switch Statement Fails Where Partition Key Defined as a Persisted Comp


Here's a very annoying and poorly (or undocumented) issue in SQL Server 2008 Ent. Ed. post-SP1, CU8:

When creating a table with a persisted computed column as the clustered primary and partitioning key (see below), where the computation includes a call to CONVERT, watch out for the representation of this calculation on sys.computed_columns.  The query parser will modify the definition at table creation to insert a default style parameter of "(0)", if no other style is specified.  If the original definition did not include any style parameter and you later attempt to programmatically recreate the table using the stored definition contained on sys.computed_columns, the query optimizer will throw an error when you then attempt to switch partitions from the original table into the new programmatically created table, as follows:

Msg 4966, Level 16, State 1, Line 72

ALTER TABLE SWITCH statement failed. Computed column '%' defined as '%' in table %' is different from the same column in table %' defined as '%'.

This is so, eventhough the two definitions are completely functionally equivalent, considering the default value of the style parameter.  This can cause a lot of headaches, because correcting the problem requires dropping and rebuilding the computed column with a definition that include

HOW to write the one insertion Procure for multiple table Records in sql server 2008


i m facing the Proble

i want to insert values into multiple table in one insertion Procedure is it Possible?

see my info

Table name UserPersonal columns

            ([UserRegform_pkID] PK


second table userRegForm columns

            ([UserRegform_pkID] PK

exporting data from table on sql server 2008 to Ms access 2007



i wana know how can i export data from a table  to access through a sql job

i am using sql server 2008 and office 2007




Max files in a single WSS 3.0 Database (SBS 2008 Server - Window Internal DB)


This site appears to indicate that the max documents per database is 32,767 :


This seems extremely small to me. Is that an accurate number? We have a customer with 300,000 documents and about 30 users. Is this going to be too much for a single DB?

Cannot generate table scripts with DateTime2 datatype in SQL Server 2008


When trying to generate a "CREATE TO" script from a SQL Server 2008 table containing either DATE or DateTime2 data types,  I get the following error:

Script failed for Table 'dbo.tMyTable'.  (Microsoft.SqlServer.Smo)
Column SnapshotDate in object tMyTable contains type DateTime2, which is not supported in the target server version, SQL Server 2005. (Microsoft.SqlServer.Smo)

However, I've checked all my databases (including master, tempdb, etc.) and ALL are cmptlevel=100.


sql server 2008 / cannot enter more data colums in table ??



I am entering data into my table directly using management studio interface.

after I get to ROW 200 in a table, it wont let me enter more rows and the next text column is shaded

with a red warning sign saying I should execute as cell is ready only

when I execute /  the row is deleted so i still can not get above row 200.


any help appreciated!



single node SQL server 2008 R2 failover cluster is down

I install a single node SQL server 2008 R2 failover cluster (server 1) and add a node (server 2) on other server . Now , the first sql server (server 1) is down , server 2 still up so i have 1 server running When i install a new single node sql server cluster on a new server two error occur (failed) : - Microsoft Cluster service (MSCS) cluster verification errors. -Cluster shared disk available check Or can i change the server 2 to the single node sql server clutser to add new node ?

Saving primary key constraint when creating new table using SELECT INTO statement - SQL Server 2008


Using SQL Server 2008:

We have a main database - MAIN.   For monthly data extracts, I create new tables with relevant data in another database called EXTRACT.

I use SELECT INTO statements to create the tables in the EXTRACT schema.  How do I preserve the primary key constraints in the EXTRACT tables?  Do I need to write separate queries to set them?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend