Tuesday, March 20, 2012
Adding table to a FileGroup
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
--
Tuesday, March 6, 2012
Adding New Drive
there anything I need to do to the D drive before I attach
a database *.ldf and *.mdf to the D drive - Do I need
another instance or any files or folders from C or do I
need to change anything on the setup. I can't find this
info anywhere.
Thank You!There is nothing you need to do unless this is a clustered instance of SQL
Server. Just create the appropriate directories, move the files into them,
and then attach the database.
If you are running a clustered server it gets a bit more involved.
"Jennifer" <jennifer.chmiel@.elder-beerman.com> wrote in message
news:030901c36d8d$256a5dd0$a101280a@.phx.gbl...
> SQL 2000 installed on C drive filling up added D drive is
> there anything I need to do to the D drive before I attach
> a database *.ldf and *.mdf to the D drive - Do I need
> another instance or any files or folders from C or do I
> need to change anything on the setup. I can't find this
> info anywhere.
> Thank You!
Sunday, February 19, 2012
adding DB from another computer
I have copied from other computer, from location "C:\Program Files\Microsoft
SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and md_db_log.ldf to other
computer to the same location, and I can't see this DB. How can I import DB
using files above?
Regards,
AreqYOu will either have to attach the database using the GUI commands for that
(Right Click on the server, either in EM or SSMS) and select attach
database, then select the appropiate database files, or use the TSQL command
sp_attachdb to attach the files. See more details about the TSQL command in
the BOL (SQL Server Help files).
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Areq,
Check BOL for sp_attach_db. That is probably what you need.
-- Bill
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Use sp_attach_db
Here is an example from BOL
EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'
Jack Vamvas
___________________________________
Advertise your IT vacancies for free at - http://www.ITjobfeed.com
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>
adding DB from another computer
I have copied from other computer, from location "C:\Program Files\Microsoft
SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and md_db_log.ldf to other
computer to the same location, and I can't see this DB. How can I import DB
using files above?
Regards,
AreqYOu will either have to attach the database using the GUI commands for that
(Right Click on the server, either in EM or SSMS) and select attach
database, then select the appropiate database files, or use the TSQL command
sp_attachdb to attach the files. See more details about the TSQL command in
the BOL (SQL Server Help files).
Jens K. Suessmeyer.
http://www.sqlserver2005.de
--
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Areq,
Check BOL for sp_attach_db. That is probably what you need.
-- Bill
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Use sp_attach_db
Here is an example from BOL
EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'
Jack Vamvas
___________________________________
Advertise your IT vacancies for free at - http://www.ITjobfeed.com
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>
Thursday, February 9, 2012
Adding a XML schema to XML schema collection
Used these steps:
SSEUtil -c
> USE "c:\Rich.mdf"
> GO
>!RUN Resume.SQL
//indicates success
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema not shown in list
> USE master
>GO
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema is shown in the query
It appears that the schema is not added to the desired database, so when I try to use the schema in Visual Studio, the schema does not appear when I connect to the Rich.mdf database. Any ideas on what I am doing wrong or why this might be happening?
Thanks
Kevin
Really strange. Maybe there is some statement in the Resume.SQL that switch database to master when creating the schema?
|||Shouldn't, this is the script file:CREATE XML SCHEMA COLLECTION ResumeXSD AS
N'<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
<xs:element name="Name" type="xs:string"></xs:element>
<xs:element name="Objective" type="xs:string"></xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="StateProv" type="xs:string" />
<xs:element name="Country" type="xs:string" />
<xs:element name="PostCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WorkExperience">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="ExpText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Reference">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="RefText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>'
GO|||Well,
I accomplished my task of adding an XML Schema Collection. I logged into SSMSE and attached the database, then did a USE on the database, pasted SQL file into a new query and it worked.
I did notice after I got his working, that the book instructed me to do this:
CREATE XML SCHEMA COLLECTION ResumeXSD AS <snipped\
but in the sample it uses dbo:
CREATE XML SCHEMA COLLECTION dbo.ResumeXSD AS <snipped\
Maybe I'll try that later and see if it works.
-Kevin