I have a Database called Products with 3 big tables Rims, Tires, and Stock
my database is as follows.
Products.mdf and Products.ldf
How can I create file groups for the tables Rims, Tires, and Stock and
attach these tables?
Example:
Products.mdf
Rims.ndf
Tires.ndf
Stock.ndfExample:
ALTER DATABASE Products ADD FILEGROUP stock_filegroup
ALTER DATABASE Products ADD FILE
(NAME = 'stock01',
FILENAME = 'C:\MSSQL\stock01.ndf',
SIZE = 10,
MAXSIZE = 20)
TO FILEGROUP stock_filegroup
The easiest way to move an existing table to another filegroup is to create
or re-create a clustered index:
CREATE CLUSTERED INDEX idx_stock ON Stock (x) ON stock_filegroup
For a non-clustered table you will have to re-create the table.
Typically it's only useful to create separate filegroups if you place the
files on separate physical devices or arrays. I assume that is what you
intend by placing your tables in this way.
David Portas
SQL Server MVP
--
Showing posts with label products. Show all posts
Showing posts with label products. Show all posts
Tuesday, March 20, 2012
Thursday, February 16, 2012
Adding data from fields to get a total
EX: I have a table for products, and each product has a quantity. How can I add up the QTY field in all the rows to find out the total QTY of all the products.
Any help would be greatly appreciated.
gkc
You don't say whether you're using a GridView or DataGrid (or anything in particular) -
I'm hoping you're using ASP.Net 2.0 and can use the GridView - because this code sample from ASPNet101.com shows how to create a calculated column - not the exact column you want, but the code's the same :
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=GVFooterTotal
Actually, I am not using any controls. I know there must be a way to do this in TSQL, I am just not familiar with it.|||check out the SUM function in SQL.|||Yes! That was exactly what I needed.
Thank you!
Subscribe to:
Posts (Atom)